note 54630 added to function.mysql-fetch-assoc
| From: | Michael at NoSpam dot example dot com | Date: | Sun, 10 Jul 2005 18:08:36 +0000 |
| Subject: | note 54630 added to function.mysql-fetch-assoc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91742@lists.php.net to get a copy of this message | ||
@x403:
The last array element is empty, if you use "<?php while ( $ar[$i++] =
mysql_fetch_assoc($res) );?>".
To avoid this, you can use:
<?php
$i = 0;
while($loopVal = mysql_fetch_assoc($resquery)){
$arrayResult[$i] = $loopVal;
$i++;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-assoc.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54630
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54630&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54630&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54630&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54630&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54630&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54630&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54630&report=yes
Search -- http://master.php.net/manage/user-notes.php