は、私は同様の改ページを行なったし、見て本当にあなたが//
<?php if (isset($patientBills['rows']) && !empty($patientBills['rows'])) { ?>
<table class="ui cell striped table">
<thead>
<tr>
<th rowspan="2">Bill No</th>
<th rowspan="2">Bill Date & Time</th>
</tr>
</thead>
<tbody>
<tbody>
<?php $rowindex =1; foreach ($patientBills['rows'] as $bill) {
?>
<tr>
<td>
<a title="View Bill" href="<?php echo BILLING_PATH . 'patient/' . $bill['patient_id'] . '/' . $rowindex * $page; ?>">
<?php echo $bill['bill_no']; ?>
</a>
</td>
<td>
<?php $date=date_create($bill['paid_date']); echo date_format($date, DATE_FORMAT); ?>
</td>
</tr>
<?php } ?>
</tbody>
</tbody>
<?php if ($patientBills['totalpages'] > 1) { ?>
<tfoot>
<tr>
<th colspan="9">
<div class="ui floated right border pagination menu ">
<a id="previousbtn" name="pageNavbtn" class="<?php echo $patientBills[ 'page']==1 ? 'disabled': ''; ?> item">
<i class="left arrow icon"></i> Previous </a>
<?php
$startPage = 1;
$loop = 0;
if ($patientBills['page'] > NO_OF_PAGES) {
$startPage = $patientBills['page'] - NO_OF_PAGES + 2;
}
for ($pag = $startPage; $pag <= $patientBills["totalpages"]; $pag++) { $loop ++?>
<a href="#" class="<?php echo $patientBills['page']== $pag ? 'disabled': ''; ?> item" name="patientPageLink" id="<?php echo $pag; ?>">
<?php echo $pag; ?>
</a>
<?php $loop == NO_OF_PAGES ? $pag = $patientBills["totalpages"] + 1:''; ?>
<?php }
if ($patientBills["totalpages"] > NO_OF_PAGES) { ?>
<a id="nextPagebtn" name="pageNavbtn" class="<?php echo $patientBills['page'] == $patientBills['totalpages'] ? 'disabled':''; ?> item">Next
<i class="icon right arrow"></i></a>
<?php } ?>
</div>
</th>
</tr>
</tfoot>
<?php } ?>
</table>
<?php } else {?>
No bills created for this patient.
<?php } ?>
<script>
$('a[name=pageNavbtn], a[name=patientPageLink]').click(function() {
var currentPage = <?php echo $patientBills['page']; ?>;
var totalpages = <?php echo $patientBills['totalpages']; ?>;
if (this.id == 'previousbtn') {
if (currentPage > 1) {
currentPage -= 1;
}
} else if (this.id == 'nextPagebtn') {
if (currentPage < totalpages) {
currentPage += 1;
}
} else {
currentPage = this.id;
}
var postData = {
page: currentPage
, patientId: <?php echo $patientId;?>
};
var Url = "<?php echo PATIENT_PATH . GET_BILL_LIST_BY_PAGENO; ?>";
triggerAjaxPost(Url, postData, function (resdata) {
$('#billlistcontainer').html(resdata);
});
});
</script>
役立ちますresdataは、html形式
に建設されます
// DB Query
$count_query = "
SELECT
COUNT(*) as count
FROM
patient_billing
WHERE
patientid = " . $patientid;
$result_count = mysqli_query($this->_connection, $count_query);
$rowcount = mysqli_fetch_array($result_count);
$count = $rowcount['count'];
$limit = $this->_limit;
$page = $this->_page;
$sidx = $this->_sidx;
$sort = $this->_sort;
$sortBy = $this->_sidx;
if (empty($sort)){
$sort = 'desc';
}
if (empty($limit)){
$limit = 1;
}
if (empty($page)){
$page = 1;
}
if (empty($sortBy)){
$sortBy = ' bill_no ';
}
if($count > 0 && $limit > 0) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
$start = $limit * $page - $limit;
if($start <0) $start = 0;
$query = "
SELECT
*
FROM
patient_billing
WHERE
patientid = " . $patientid . " " .
" ORDER BY " . $sortBy . " " . $sort
. " LIMIT " . $start .",". $limit;
$result = mysqli_query($this->_connection, $query) or die("Couldn't execute query: " . mysqli_error($this->_connection));
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$responce[] = $row;
}
}
$patientBills= array("totalpages"=>$total_pages, "page"=>$page, "records"=>$count, "rows"=>$responce);
あなたはPHPを使用していますか? 。ネット?あなたのクライアントにコンテンツを返すのですか? – fictus
私はPHPを使用しています! – platanas20