note 13392 added to function.mysql-fetch-array.php
| From: | jpeterso at moody dot edu | Date: | Thu, 14 Jun 2001 15:26:22 +0000 |
| Subject: | note 13392 added to function.mysql-fetch-array.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14375@lists.php.net to get a copy of this message | ||
The code above is great to write the variable's one time and refer to them when you need to
then loop through the next item.
In a controled environment, I used this code in a for loop to create columns. You still need to put
it in a loop for multiple items.
$ary = mysql_fetch_assoc($query_variable);
if(is_array($ary)){
while (list($key,$val) = each($ary)) {
$$key = $val;
}
} else {
break 1;
}
I continuely got errors without the else break clause. This breaks me out of my for loop. Hope it
helps.
http://www.php.net/manual/en/function.mysql-fetch-array.php