Php 在5行之后显示段落文本
我是编程新手。 我试图在数据库的5行之后显示文本。 提前谢谢 例如:Php 在5行之后显示段落文本,php,Php,我是编程新手。 我试图在数据库的5行之后显示文本。 提前谢谢 例如: <row></row> <row></row> <row></row> <row></row> <row></row> <p>Hello World</p> <row></row> <row></row> <ro
<row></row>
<row></row>
<row></row>
<row></row>
<row></row>
<p>Hello World</p>
<row></row>
<row></row>
<row></row>
<row></row>
<row></row>
<p>Hello World</p>
<row></row>
<row></row>
<row></row>
<row></row>
<row></row>
php代码工作得很好,我只是想如果我想在大约5行之后显示一个图像或文本该怎么办。请帮助我。$post\u status=“Published”;
$post_status= "Published";
$stmt = $mysqli->prepare("SELECT * FROM user_post WHERE status = ? GROUP BY post_id ORDER BY post_id DESC");
$stmt->bind_param('s', $post_status);
$stmt->execute();
$result = $stmt->get_result();
$counter = 1;
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo '<row>Your row</row>'
if ($counter % 5 == 0) {
echo '<p>Your paragprah</p>';
}
$counter++;
}
}
else {
echo "No User Post";
}
$stmt=$mysqli->prepare(“选择*来自用户的帖子,其中状态=?按帖子分组\u id按帖子排序\u id描述”);
$stmt->bind_参数('s',$post_status);
$stmt->execute();
$result=$stmt->get_result();
$counter=1;
如果($result->num_rows>0){
而($row=$result->fetch_assoc()){
回应“你的排”
如果($counter%5==0){
呼应你的帕拉普拉;
}
$counter++;
}
}
否则{
回显“无用户帖子”;
}
$post_status= "Published";
$stmt = $mysqli->prepare("SELECT * FROM user_post WHERE status = ? GROUP BY post_id ORDER BY post_id DESC");
$stmt->bind_param('s', $post_status);
$stmt->execute();
$result = $stmt->get_result();
$counter = 1;
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo '<row>Your row</row>'
if ($counter % 5 == 0) {
echo '<p>Your paragprah</p>';
}
$counter++;
}
}
else {
echo "No User Post";
}