Page 1 of 1
Calling a variable from a db table output
Posted: Mon Dec 31, 2007 8:42 pm
by pinehead18
Example
***** PLEASE USE TAGS FOR CODE *****
Code: Select all
$sql = mysql_query("SELECT html FROM html");
$row = mysql_fetch_array($sql);
$html = $row['html'];
$body = "i'm the body";
$html then has the output of <html>$body</html>
but $html wont look at the variable $body.
Any ideas?
Posted: Mon Dec 31, 2007 9:22 pm
by Christopher
What do you mean "$html wont look at the variable $body" ? How does a variable "look" at another variable?
Posted: Mon Dec 31, 2007 9:40 pm
by pinehead18
Well when $html = <body>$body</body> that is the data in the table.
I want it to somehow call $body.
can it not?
Posted: Mon Dec 31, 2007 9:57 pm
by Christopher
pinehead18 wrote:Well when $html = <body>$body</body> that is the data in the table.
I want it to somehow call $body.
can it not?
You can "call" a variable. $html is being assigned the value in $row['html'] which is in the database. If you then do
$html = "<body>$body</body>"; then $html will now contain "<body>Whatever body variable contained</body>".
Posted: Mon Dec 31, 2007 11:34 pm
by crystal ship
What is the real problem? Clearify. I can't get any clue here. What are you really trying to do?