RE: [PHP] build array dinamicaly
| From: | Tim Ward | Date: | Tue, 30 Apr 2002 07:53:38 +0000 |
| Subject: | RE: [PHP] build array dinamicaly | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-95328@lists.php.net to get a copy of this message | ||
Be careful - I fell into this trap when I first started doing this sort
of thing. This code will produce an extra element on your array
with value logical false. You need to do ...
While ($array = mysql_fetch_array($result)) $myarray[] = $array;
... to avoid this
Tim Ward
Internet Chess www.chessish.com <http://www.chessish.com>
----------
From: Richard Emery [SMTP:remery@emeryloftus.com]
Sent: 29 April 2002 21:57
To: Rodrigo Peres; PHP
Subject: Re: [PHP] build array dinamicaly
$query = "SELECT name,address FROM tbl";
$result = mysql_query($query);
while($myarray[] = mysql_fetch_array($result);
----- Original Message -----
From: Rodrigo Peres <rperes@mac.com>
To: PHP <php-general@lists.php.net>
Sent: Monday, April 29, 2002 9:20 AM
Subject: [PHP] build array dinamicaly
Hi list,
I want to buil an multidimensional array with the results of Mysql,
but I
don't know how to do it.
What I need is:
"SELECT name,adress from tbl_....."
array name will receive the names
array adress will receive the adresses
and array clientes will contain both, so when i try to access i will
have
something like $cliente['nome'][0] or $clientes['adress'][1] and so
on.
Someone can help???
Thank's in advace
Rodrigo Peres
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php