Re: Extract all fields of a table to vars of same name
| From: | Jim | Date: | Tue, 04 Dec 2001 19:17:54 +0000 |
| Subject: | Re: Extract all fields of a table to vars of same name | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76576@lists.php.net to get a copy of this message | ||
I do this ...
$query = mysql_query("SELECT * FROM foo");
$data = mysql_fetch_assoc($query);
extract($data);
if you need all the rows from the query, do ...
$query = mysql_query("SELECT * FROM foo");
while($data = mysql_fetch_assoc($query) {
extract($data);
}
Jim
Someone came with a very clever solution to simplify the extraction of all-- Jim Musil --------- Multimedia Programmer Nettmedia ------------- 212-629-0004 jim@nettmedia.comfields when doing a select * from tableit's a command that passes all values from the fields on the table to variables of the same name than the field on that table. No need to program it manually, creates all variables with same names as the table fields. Could someone tell me how to do this? Alfredo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net