$resultSet = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 7");
$product_count = mysql_num_rows($resultSet);
if($product_count >0){
while( mysql_fetch_array($resultSet)){
$id= $row["id"];
$cat= $row["categories"];
$title= $row["title"];
$image= $row["image"];
$txt= $row["txt"];
$res= $row["resource"];
}
}
else
{ echo'site is under maintaince ';}
echo " <div class=\"row-fluid\">
<div class=\"span6 post no-margin-left\">
<figure>
<img src=\"$image\" alt=\"Thumbnail 1\" />
<div class=\"cat-name\">
<span class=\"base\">'$cat'</span>
<span class=\"arrow\"></span>
</div>
</figure>
<div class=\"text\">
<h2><a href=\"single_post.html\" title=\"$title\">'$title'</a></h2>
<p>$txt</p>
<div class=\"meta\">By <a href=\"$res\">' $res'</a> | '$date' | <a href=\"single_post.html\">15 comments</a></div>
</div>
</div>
</div>";
?>
代码未显示表的输出结果。你能告诉我我做错了什么吗?我想在div类中显示输出。我的分页工作正常,但没有正确显示输出。你能指导我吗?我真的很感激。
答案 0 :(得分:0)
while( mysql_fetch_array($resultSet)){
$id= $row["id"];
$cat= $row["categories"];
$title= $row["title"];
$image= $row["image"];
$txt= $row["txt"];
$res= $row["resource"];
}
}
循环中的$ row在哪里?但是,要填充所有结果,您需要在循环内打印,否则您将无法迭代