note 106421 added to function.mysql-fetch-array

From: Date: Tue, 08 Nov 2011 21:28:59 +0000
Subject: note 106421 added to function.mysql-fetch-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-184336@lists.php.net to get a copy of this message
<?php while($r[]=mysql_fetch_array($sql)); ?> Yes, that will generate a dummy array element containing the false of the final mysql_fetch_array. You should either truncate the array or (more sensibly in my mind) check that the result of mysql_fetch_array is not false before adding it to the array. ---- Server IP: 69.147.83.197 Probable Submitter: 86.4.255.117 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php Edit -- https://master.php.net/note/edit/106421 Del: integrated -- https://master.php.net/note/delete/106421/integrated Del: useless -- https://master.php.net/note/delete/106421/useless Del: bad code -- https://master.php.net/note/delete/106421/bad+code Del: spam -- https://master.php.net/note/delete/106421/spam Del: non-english -- https://master.php.net/note/delete/106421/non-english Del: in docs -- https://master.php.net/note/delete/106421/in+docs Del: other reasons-- https://master.php.net/note/delete/106421 Reject -- https://master.php.net/note/reject/106421 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#184336) next »