你好,我有两个文件,一个文件包含主要帖子,第二个文件包含加载更多帖子代码
以下是主文件的代码,但在这个文件中,我有一个问题,我必须循环php中的所有mysql行,我可以使用while循环来做到这一点,但是当我尝试这样做时,我会得到所有行,但在15行之后,它只显示那些在15行之后的行,比如只有16行
我的主要.php代码
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$nv_name_split = str_replace('_', ' ', $row['novel_name']);
echo '<br><a href="episode?novel='.$row['novel_name'].'&episode='.$row['episode_num'].'"><figure class="snip1253"><div class="image"><img width="100%"src="images/sneakpeaks/'.$row['sneak_peak'].'" alt="sample59"/></div><figcaption>'.
'<div class="date"><span class="day">'.$row['day'].'</span><span class="month">'.$row['month'].'</span></div><h3>Episode # '.$row['episode_num'].'</h3> <footer>
<div class="writer text-center"><i class="fa fa-book"> '.$nv_name_split.'</i></div>
<div class="love"><i class="fa fa-thumbs-up"></i>'.$row['likes'].'</div>
<div class="comments"><i class="fa fa-comments"></i>'.$row['comments'].'</div></footer></figure></a></figcaption><br><br>';
}
?>
<?php
$stmt_count = $novel_list->runQuery("SELECT episode_num
FROM posts
WHERE just_skpk='0'");
$stmt_count->execute();
while ($rows = $stmt_count->fetch(PDO::FETCH_ASSOC)) {
$count_row = $rows['episode_num'];
}
if ($limit < $count_row) {
echo'<form id="frm_more_post">
<center>
<button type="submit" class="form-control btn btn-load_more" id="frm_btn_more">Load More Posts</button>
</center>
</form>
<br>
<br>';
}else{
echo'<form id="frm_more_post">
<center>
<button type="submit" disabled class="disabled form-control btn btn-load_more" id="frm_btn_more">No More Posts</button>
</center>
</form>
<br>
<br>';
}
这是我load_more.php代码,我使用ajax发布帖子限制
慕田峪4524236
慕无忌1623718