Creating a varable with a name held in a string
| From: | lists) | Date: | Fri, 11 Feb 2005 00:36:16 +0000 |
| Subject: | Creating a varable with a name held in a string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-208498@lists.php.net to get a copy of this message | ||
I have the following code;_
$sql = "select * from text where id = '$id' ";
$row = fetch_row_row( $sql, $db );
$img_loc = $row["img_loc"];
$text_type = $row["text_type"];
$seq = $row["seq"];
$rec_type = $row["rec_type"];
$section = $row["section"];
$code = $row["code"];
$repeat = $row["repeat"];
$description = $row["description"] );
$text = $row["text"] );
Was wondering if there was a clever way of doing this with foreach on
$row. something like
foreach( $row as $index => value ) {
create_var( $index, $value );
}
So the question is is there a function like create_var which takes a
string and a value and creates a variable?
Ben
--
Ben Edwards - Poole, UK, England
If you have a problem sending me email use this link
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)
--
Ben Edwards - Poole, UK, England
If you have a problem sending me email use this link
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc