จะทำแบ่งหน้าข้อมูล ต้องทำยังไงคะ คือตอนนี้โปรแกรมตัด เหลือข้อมูลที่ต้องการโชว์แล้วแต่ยังคลิกเลือกโชว์ส่วนถัดไปไม่ได้ และก็มี Error ขึ้น
อยากทราบว่าต้องแก้ไขโค้ดตรงไหน ยังไง ค่ะ
โค้ดที่ทำโปรแกรมค่ะ
โค้ด: เลือกทั้งหมด
<?php
require_once 'conn.php';
if (isset($_GET['id'])) {
mysql_query("DELETE FROM vat WHERE id = ".$_GET['id']);
}
$sql = "SELECT * FROM vat ";
$result = mysql_query($sql);
$total = mysql_num_rows($result);
$start = $pages*10;
$sql = "SELECT * FROM vat ORDER BY id desc Limit $start,10";
$result = mysql_query($sql);
?>
<?php include 'header.php';?>
<div align="center">
<h3>ตารางแสดงข้อมูลผู้เข้าใช้งาน</h3>
</div>
<div class="row" align="center">
<div class="col-md-12">
<table id="table-listtax" class=" table table-striped ">
<tr>
<th bgcolor="#8c8cd9"><p align="center">ลำดับ</p></th>
<th bgcolor="#8c8cd9"><p align="center">ชื่อผู้ใช้งาน</p></th>
<th bgcolor="#8c8cd9"><p align="right">จำนวนเงิน</p></th>
<th bgcolor="#8c8cd9"><p align="right">ภาษีมูลค่าเพิ่ม <br>Vat 7 %</p></th>
<th bgcolor="#8c8cd9"><p align="right">จำนวนเงิน<br>ก่อนบวกภาษี</p></th>
<th bgcolor="#8c8cd9"><p align="center">เวลาเข้าใช้งาน</p></th>
<th bgcolor="#8c8cd9"><p align="center">หมายเลข<br>IP_Address</p></th>
<th bgcolor="#8c8cd9"><p align="center">แสดงข้อมูล</p></th>
</tr>
<?php while ($fetch = mysql_fetch_assoc($result))
{
?>
<tr>
<td align="center"><?php echo $fetch['id'] ; ?></td>
<td align="center"><?php echo $fetch['name']; ?></td>
<td align="right"><?php echo number_format($fetch['price'],2); ?></td>
<td align="right"><?php echo number_format($fetch['vat'],2); ?></td>
<td align="right"><?php echo number_format($fetch['money'],2); ?></td>
<td align="center"><?php if ($fetch['time']){
date_default_timezone_set("Asia/Bangkok");
echo (date(" H:i:s / d-m-Y ",$fetch['time']));
}else {
echo "ยังไม่มีเวลาแก้ไข";
} ?></td>
<td align="center"><?php echo $fetch['ip_address']; ?></td>
<td align="center">
<a href="showvat.php?id=<?php echo $fetch['id']; ?>"><button type="button" class="btn1 btn-primary">
<i class="glyphicon glyphicon-new-window"></i></button></a>
</td>
</tr>
<?php
}
?>
</table>
</div>
</div>
<div class="text-center">
<nav aria-label="Page navigation">
<ul class="pagination">
<li>
<a href="#" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
<?php
$pages = ceil($total/10);
for ($i=1; $i <=$pages ; $i++) {
echo '<li><a href="listvat.php?page">'.$i.'</a></li>';
}
?>
<li>
<a href="#" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
</ul>
</nav>
ทั้งหมด <?php echo "$total";?> รายการ <br><br>
</div>
<div align="center">
<br><input type="button" class="btn btn-primary" onclick="window.location='vat.php';" value="กลับไปหน้าหลัก">
</div>
<?php include 'footer.php';?>