error on show all date items from datebase
error on show all date items from datebase:
on datebase:
Title1
Title2
Title3
php code:
$postdb = mysql_query("SELECT * FROM wtable");
$post = mysql_fetch_assoc($postdb);
while ($poste = @mysql_fetch_array($postdb))
{
echo $poste['posttitle'];
echo "开发者_运维知识库<br />";
}
output:
Title2
Title3
$post = mysql_fetch_assoc($postdb);
Is returning the first result and then moving the cursor forward.
Comment out this line and try again.
Example:
$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 />";
}
精彩评论