| Naintara 2006-02-20, 6:56 pm |
| Hi,
Firstly, if you are assigning the value of variable $myrow['article_title']
to $right_row,
you should print $right_row and not $$right_row
Because, if say, $myrow['article_title'] contained value "article1",
$$right_row would look for variable
$article1, which probably doesn't exist, hence no value.
You could also try creating your field name simpler, something like:
$tmp_fldname = $type . "_title';
$right_row = $myrow[$tmp_fldname];
This should work, I haven't tested it.
Naintara
-----Original Message-----
From: Andrew Darby [mailto:adarby@gmail.com]
Sent: Monday, February 20, 2006 10:19 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Help with Variable Variables in Array
Hi, all. I can't quite figure out how to call the contents of a
variable variable in a mysql_fetch_array result and was hoping someone
could help . . .
inside the "fetch all rows" while loop, i have the following:
$right_row = "$" . myrow . "['" . $type . "_title']";
($type is assigned elsewhere, but in this case = 'article')
which outputs:
$myrow['article_title']
So far so good, but i can't seem to output the value of this variable
by printing
$$right_row
Any suggestions?
TIA,
Andrew
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17-Feb-06
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 17-Feb-06
|