mysql_fetch_array
| From: | Andrew.Martin | Date: | Wed, 18 Jul 2001 14:01:48 +0000 |
| Subject: | mysql_fetch_array | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-8373@lists.php.net to get a copy of this message | ||
I'm using this function to check the value of specific fileds per row in the
database.
such as....
$query = "SELECT * FROM $dbn WHERE status = 4";
$result = mysql_query($query) or die("failed to connect to DB");
while ($row = mysql_fetch_array ($result)) {
print "row id = $row[id]";
print "decription in row = $row[description]";
}
this works fine, it checks the DB for values with status = 4 and prints row
id and row description
My problem occurs when I want to creat variables based on these results.
I would ideally like to create dynamic variables based on row_id number e.g.
variable_row[id] = $row[description]
so later in the dynamically created page I could enter $variable_1 (1 being
the row[id] value) and the correct value would be selected. Is there anyway
of doing this? I tried using $$variable etc but no luck.
Any ideas appriciated.
Andrew