php mysql whats wrong here
what am i doing wrong here:
$numrow = mysql_num_rows($display);
echo '<br>'.$numrow;
$printout=mysql_fetch_assoc($display);
print_r($printout);
This outputs:
40Array ( [id] => 97132 )
So it shows that their are 40 rows, which is good, but I want it to output all 40 of the ellements that the mysql q开发者_JAVA百科uery returns...
Try
$numrow = mysql_num_rows($display);
echo '<br>'.$numrow;
while($printout=mysql_fetch_assoc($display)){
print_r($printout);
}
As reaction to your comment: If you want just the id's you can do this
$numrow = mysql_num_rows($display);
echo '<br>'.$numrow;
while($printout=mysql_fetch_assoc($display)){
echo $printout['id'];
}
@David19801: Try --
while($printout = mysql_fetch_assoc($display))
{
echo $printout['id'] . "<br>\n";
}
精彩评论