One record 10 records loop 我有麻煩顯示正確的記錄,結束後,我需要使用分頁。 v_news.php 如何顯示每頁10條記錄,然後如何使用分頁?
<div class="news">
<a href="index.php?ogloszenie='<?php $row['id_article']; ?>'">
<div class="newstitle">
<?php echo $row['title'];?>
</div>
<div class="newsauthor">
<?php echo $row['username'];?>
</div>
<div class="newscomment">
comments: 56
</div>
<div class="newsdate">
<?php echo $row['timestamp'];?>
</div>
</a>
</div>
<?php
if(!isset($_SESSION['id'])){
header("Location: index.php");
exit();
}else{
$result = $Database->query("SELECT * FROM article LIMIT 0, 10");
if($result->num_rows != 0){
$rows = $result->fetch_assoc();
foreach ($rows as $row){
include("views/v_news.php");
}
}else{
echo "No results";
}
}
隨着foreach循環我有一個錯誤的非法串$行[ '']偏移。我不知道該怎麼做。
這是我的錯。我重寫了這幾次。 –