RE: [PHP] explode? (table field to a variable of same name)
| From: | Rick Emery | Date: | Tue, 19 Feb 2002 20:46:36 +0000 |
| Subject: | RE: [PHP] explode? (table field to a variable of same name) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-85435@lists.php.net to get a copy of this message | ||
This isn't exactly what you want, but it is close:
list($user_id,$field2,$field3,$field4) = $row;
where $row was retrieved via mysql_fetch_array()
Just list each of the variable names in the list() function; include ALL
fields' names included in $row
-----Original Message-----
From: Baloo :0) [mailto:alfredo@mexbus.net]
Sent: Tuesday, February 19, 2002 3:41 PM
To: php-general@lists.php.net
Subject: [PHP] explode? (table field to a variable of same name)
How can I assign automatically all fields of a database to a variable of
the same name?
Instead of having to manually do
$user_id=$row["user_id"];
etc
Then how could I know the number of fields in the table so I can do a
loop to print them all in html?
In advance, thanks for your help.
Alfredo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php