โดย moomai » 08/03/2017 3:53 pm
ต้องการให้บรรทัดตารางแสดงข้อมูลคนละสีกันโดยใช้ bootstrap ต้องทำยังไงค่ะ
คือนำ class="table table-striped" ของ bootstrap มาใช้แล้ว แต่ตอนแสดงข้อมูลมันไม่สับสีกัน เป็นเพราะอะไรคะ ต้องแก้ยังไง
โค้ดที่ทำ
โค้ด: เลือกทั้งหมด
<table id="table-listtax" class="table table-striped" >
<thead>
<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="center">ภาษี %</p></th>
<th bgcolor="#8c8cd9"><p align="right">เงินภาษี </p></th>
<th bgcolor="#8c8cd9"><p align="right">จำนวนเงินหลังหักภาษี</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>
</thead>
<?php
while ($fetch = mysql_fetch_assoc($result)) {
?>
<tbody>
<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="center"><?php echo $fetch['tax']; ?></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
date_default_timezone_set("Asia/Bangkok");
echo (date(" Y-m-d / H:i:s ",$fetch['time'])); ?></td>
<td align="center"><?php echo $fetch['ip']; ?></td>
<td align="center">
<a href="showtax.php?id=<?php echo $fetch['id']; ?>"><button type="button" class="btn btn-primary">
<i class="glyphicon glyphicon-new-window"></i></button></a>
</td>
</tr>
</tbody>
<?php
}
?>
</table>
ผลที่ได้ค่ะ
- Capture.PNG (3.75 KiB) Viewed 483 times
ต้องการให้บรรทัดตารางแสดงข้อมูลคนละสีกันโดยใช้ bootstrap ต้องทำยังไงค่ะ
คือนำ class="table table-striped" ของ bootstrap มาใช้แล้ว แต่ตอนแสดงข้อมูลมันไม่สับสีกัน เป็นเพราะอะไรคะ ต้องแก้ยังไง
โค้ดที่ทำ
[code]<table id="table-listtax" class="table table-striped" >
<thead>
<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="center">ภาษี %</p></th>
<th bgcolor="#8c8cd9"><p align="right">เงินภาษี </p></th>
<th bgcolor="#8c8cd9"><p align="right">จำนวนเงินหลังหักภาษี</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>
</thead>
<?php
while ($fetch = mysql_fetch_assoc($result)) {
?>
<tbody>
<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="center"><?php echo $fetch['tax']; ?></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
date_default_timezone_set("Asia/Bangkok");
echo (date(" Y-m-d / H:i:s ",$fetch['time'])); ?></td>
<td align="center"><?php echo $fetch['ip']; ?></td>
<td align="center">
<a href="showtax.php?id=<?php echo $fetch['id']; ?>"><button type="button" class="btn btn-primary">
<i class="glyphicon glyphicon-new-window"></i></button></a>
</td>
</tr>
</tbody>
<?php
}
?>
</table>[/code]
ผลที่ได้ค่ะ
[attachment=0]Capture.PNG[/attachment]