Re: Extract all fields of a table to vars of same name
| From: | Fred | Date: | Tue, 04 Dec 2001 20:00:06 +0000 |
| Subject: | Re: Extract all fields of a table to vars of same name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76585@lists.php.net to get a copy of this message | ||
If you have this select statement:
$Query = "SELECT First, Second, Third FROM Table1";
and you execute the statement like this:
$Result = mysql_query($Query);
and retrieve a row like this:
$Row = mysql_fetch_assoc($Result);
then extract the row like this:
extract ($Row);
you end up with these variables:
$First, $Second, $Third
containing the value of the respective fields.
Fred
Baloo :0) <alfredo@mexbus.net> wrote in message
news:3C0D307C.8053590E@mexbus.net...
> Someone came with a very clever solution to simplify the extraction of
> all
> fields when doing a select * from table
>
> it'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
>