parsing variables inside a variable?
| From: | jimbo | Date: | Thu, 29 Jan 2004 14:56:25 +0000 |
| Subject: | parsing variables inside a variable? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-176277@lists.php.net to get a copy of this message | ||
Hi,
I have a query regarding variable parsing.
I have some text in a MySQL database in which I have included some variable
names. Eg (but w/o quotes): "thankyou $name for registering on our web
site".
I query and use mysql_fetch_array to get the data into an associative array.
I then build a string and output it like this:
echo "blah blah ".$row["thecolumn"]." blah blah";
However, the output is simply: "blah blah thankyou $name for registering on
our web site blah blah" - i.e. $name does not get parsed. I have tried
wrapping $name with curly brackets in the database but that doesn't help and
I have also tried using both addslashes and removeslashes on
$row["thecolumn"] and I have also tried this: echo "blah blah
$row['thecolumn'] blah blah" - again both with and without curly brackets.
Nothing seems to work. Is what I am trying to do possible?
Thanks in advance,
James Holt
--
--------------------------------------------------------
www.jholt.co.uk : affordable business website solutions
www.htpshareware.com : software for the disorganized
--------------------------------------------------------