我有一個數據庫,我試圖通過PHP編輯顯示。在主頁上,我只想顯示錶格的前15行,然後讓用戶單擊以生成更多表格行。PHP /數據庫表循環 - 在時間只顯示15行
<?php
include('../config.php');
$result = $mysqli->query("SELECT uid, title, description, tblFacilityHrsDateTimes.* FROM tblFacilityHrs LEFT JOIN tblFacilityHrsDateTimes ON tblFacilityHrs.uid = tblFacilityHrsDateTimes.owner_uid ORDER BY tblFacilityHrs.title") or die($mysqli->error);
while($row =$result->fetch_assoc()){
extract ($row);
echo "<tr>";
echo "<td> {$id} </td>"; //hide when finished
echo "<td> {$title} </td>";
echo "<td> {$description} </td>";
echo "<td> {$startEventDate} </td>";
echo "<td> {$endEventDate} </td>";
echo "<td> {$startTime} </td>";
echo "<td> {$endTime} </td>";
echo "<td> {$days} </td>";
echo "<td> {$recurrence} </td>";
echo "<td> {$finalDate} </td>";
echo "<td>";
echo "<a class=\"buttons\" href=edit.php?id={$id}&uid={$uid}>Edit</a><span class='icon'></span></a>
";
echo "/";
echo "<a class=\"buttons\" href='javascript: Confirm()'>Delete</a>";
echo "</td>";
echo "</tr>";
echo "</div>";
}
echo "</table>";
$result->free();
$mysqli->close();
?>
@에이바,你想顯示15條每頁也就是說,如果有100條記錄,然後四頁15條記錄每個? – w0051977
是的,這正是我想要做的。 –