 |
|
Code (PHP)
<table>
<?php do { ?>
<tr>
<td width="80%"><a href="<?PHP echo empty($row_postrcs['post_file']) ? $row_postrcs['post_link'] : 'file/'.$row_postrcs['post_file']; ?>"><?php echo $row_postrcs['post_text']; ?>
</a>
</td>
<td width="11%">
<div align="center"><a onclick="MM_openBrWindow('update-post.php?postid=<?php echo $row_postrcs['id']; ?>','editpost','scrollbars=yes,resizable=yes,width=600,height=200')"><button class="button button4">แก้ไข</button></a></div>
</td>
<td width="9%">
<div align="center"><a href="delete-post.php?id=<?php echo $row_postrcs['id']; ?>"><button class="button button3">ลบ</button></a></div>
</td>
</tr>
<?php } while ($row_postrcs = mysql_fetch_assoc($postrcs)); ?>
</table><br />
<button class="button button5">ดูทั้งหมด</button>
นี้เป็นโค้ดส่วนที่โชว์และปุ่มดูทั้งหมด
Code (PHP)
$maxRows_postrcs = 10;
$pageNum_postrcs = 0;
if (isset($_GET['pageNum_postrcs'])) {
$pageNum_postrcs = $_GET['pageNum_postrcs'];
}
$startRow_postrcs = $pageNum_postrcs * $maxRows_postrcs;
mysql_select_db($database_myconnection, $myconnection);
$query_postrcs = "SELECT * FROM post ORDER BY id DESC";
$query_limit_postrcs = sprintf("%s LIMIT %d, %d", $query_postrcs, $startRow_postrcs, $maxRows_postrcs);
$postrcs = mysql_query($query_limit_postrcs, $myconnection) or die(mysql_error());
$row_postrcs = mysql_fetch_assoc($postrcs);
if (isset($_GET['totalRows_postrcs'])) {
$totalRows_postrcs = $_GET['totalRows_postrcs'];
} else {
$all_postrcs = mysql_query($query_postrcs);
$totalRows_postrcs = mysql_num_rows($all_postrcs);
}
$totalPages_postrcs = ceil($totalRows_postrcs/$maxRows_postrcs)-1;
นี้เป็นโค้ดคำสั่งโชว์ค่ะ
รบกวนผู้รู้ทีนะค่ะ เป็นมือใหม่ php ค่ะ
Tag : PHP, MySQL, HTML, CSS, HTML5, JavaScript
|
ประวัติการแก้ไข 2018-09-18 14:16:06
|
 |
 |
 |
 |
Date :
2018-09-14 10:21:52 |
By :
ampere27 |
View :
691 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |