note 33503 added to function.mysql-fetch-array

From: Date: Fri, 27 Jun 2003 21:11:07 +0000
Subject: note 33503 added to function.mysql-fetch-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-51116@lists.php.net to get a copy of this message
Having problems with mysql_fetch_array(), I think. The problem is with the code bellow, I allways miss out the first record. If I for example finds 2 records ($num_rows=2), only one gets displayed. What am I doing wrong here? Can someone fix my code? $sql = "SELECT * FROM something"; $result = mysql_db_query("mydb","$sql"); $rows = mysql_fetch_array($result); $num_rows = mysql_num_rows($result); while($rows=mysql_fetch_array($result)) { ?> A row: <?=$rows["myfield"]?><br><? } ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33503 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33503&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33503&report=yes

« previous php.notes (#51116) next »