Variables in database content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there. I have what I suspect is an easy one, but was unable to find something similar in the archives (it's a tough one to search for...).

Basically I have a table with a text block column. The actual content that lives in column contains php variables that I want to be able to use when I pull the text out of the database. Let me give you an example:

Content:
"Hi there. My name is $name. This is a bunch of text that $othername is telling me to populate with some data. Hopefully you will be able to help $othername and I get this to work. Thanks!"


Now, in my script I want to be able to pull names out of another table, initialize the $name and $othername variables, then pull out the content above, parse the "names" variables and display it in the browser.

My problem is the variables don't get parsed. I've tried a few obvious things, like storing the text in a variable, using print or echo, and so-on, even processing it with the various text-to-html functions hoping that it would process the variables, but it seems like it's treating the text as a literal and not actually parsing the variables.

I suspect it has something to do with either the order, the method of output, or some pre-processing that I'm missing, but after a few hours I simply can't get it.

Thanks for any advice!

-b

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux