错误显示数据库中的所有日期项目: 数据库:
Title1
Title2
Title3
php代码:
$postdb = mysql_query("SELECT * FROM wtable");
$post = mysql_fetch_assoc($postdb);
while ($poste = @mysql_fetch_array($postdb))
{
echo $poste['posttitle'];
echo "<br />";
}
输出:
Title2
Title3
答案 0 :(得分:3)
$post = mysql_fetch_assoc($postdb);
返回第一个结果,然后向前移动光标。
注释掉这一行,然后再试一次。
示例:
$postdb = mysql_query("SELECT * FROM wtable");
//$post = mysql_fetch_assoc($postdb); <-- comment out this line
while ($poste = mysql_fetch_array($postdb)) { // <-- don't use @ here, we want to know if something went wrong!
echo $poste['posttitle'];
echo "<br />";
}