0
下一頁消息,我有一個問題,想表明我在超過1頁新聞與下一個按鈕 和繼承人我的代碼:如何顯示在使用PHP和PDO
<?php
$stmt = $DB_con->prepare('SELECT userID, userName, userProfession, userPic, postDate FROM tbl_users ORDER BY userID DESC');
$stmt->execute();
$foundData = false;
if($stmt->rowCount() > 0)
{
$foundData = true;
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
extract($row);
?>
<ul class="col-md-12 blog-posts post-list">
<li class="blog-post clearfix">
<div class="post-media">
<a href="">
<img src="user_images/<?php echo $row['userPic']; ?>" class="img-responsive" alt="Construction HTML Template"/>
</a>
</div><!-- .post-media end -->
<div class="icon-container">
<i class="fa fa-calendar"></i>
</div>
<div class="post-body">
<div class="post-date">
echo '<p>'. mds_date("Y/m/d", strtotime($row['postDate']), 0).'</p>'; ?>
</div>
<a href="">
<h3><?php echo $userName." "; ?></h3>
</a>
<p>
<?php echo $userProfession." "; ?>
</p>
</div><!-- .post-body end -->
</li><!-- .blog-post end -->
<?php
}
}
else
{
if(isset($foundData) && !$foundData){
echo " no data found ." ;
}
}
?>
</ul>
您在哪裏顯示新聞並將該div作爲固定的一個,它將顯示在所有頁面中 – Karthi
新聞Feed僅與網頁版一起顯示...首先您嘗試使用它... http://www.codingcage.com /2015/04/how-to-create-pagination-with-php-pdo.html @reza –
檢出MYSQL'LIMIT',它可以幫你做好準備,也許還會有'COUNT' – Bobot