rempires Posted October 29, 2006 Share Posted October 29, 2006 Okay, i guess to start, i have a page and i'm trying to echo a variable that containes a some html and other variables, this data is stored in a database, so it starts like this[code]$sql = "SELECT HeaderFormat FROM News_Format WHERE FormatID='$format'";$result = mysql_query($sql) or die("Failed to run query to get format data.");$row = mysql_fetch_array($result,MYSQL_ASSOC);$HeaderFormat = $row['HeaderFormat'];unset($result); //must be done for later in script[/code]the variable $HeaderFormat in this case contains[code]<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='100%' id='AutoNumber1'> <tr> <td width='33%'>$postDate</td> <td width='33%'>$title</td> <td width='34%'>$user </td> </tr> <tr> <td width='100%' colspan='3'> <font color='#ffffff'> $header ...</font> <p align='center'> $views | $comments | $fullstory </td> </tr></table>[/code] - that was copied directly from the databasethe next 100 or so lines jsut determines what the otehr variables like $views, $comments are.we then call a function, this is the next time heaerFormat is tuched, all it is is[code]function showdata(){global $PostDateTime, $HeaderFormat;echo "$HeaderFormat";[/code]well tehre is a little more code, but nothing touches that variable, when this script is displayed, teh html takes affect but the browser will output:$postDate $title $user$header ... $views | $comments | $fullstory the variables still show up, i want the variables to show the data they obtained earlier, i can't figure this one out because if i take that exact same code from the database and put it into $header bypasses the whole database process it works perfect, is there some way the mysql dataabase works that interferring with this, please helpthanks in advance, johnp.s. if you need more code please ask the entire script is 115 lines, not to many but i didn't want to post all that if it's not necisary Quote Link to comment https://forums.phpfreaks.com/topic/25459-variables-inside-of-variables/ Share on other sites More sharing options...
bqallover Posted October 29, 2006 Share Posted October 29, 2006 You might want to take a look at this thread: [url=http://www.phpfreaks.com/forums/index.php/topic,112882.0.html]http://www.phpfreaks.com/forums/index.php/topic,112882.0.html[/url] Quote Link to comment https://forums.phpfreaks.com/topic/25459-variables-inside-of-variables/#findComment-116168 Share on other sites More sharing options...
.josh Posted October 29, 2006 Share Posted October 29, 2006 [url=http://www.php.net/eval]eval()[/url] Quote Link to comment https://forums.phpfreaks.com/topic/25459-variables-inside-of-variables/#findComment-116169 Share on other sites More sharing options...
rempires Posted October 29, 2006 Author Share Posted October 29, 2006 I had tried that, eval() doesn't seem to like the "<" & ">" that are stored in the database... Quote Link to comment https://forums.phpfreaks.com/topic/25459-variables-inside-of-variables/#findComment-116171 Share on other sites More sharing options...
rempires Posted October 29, 2006 Author Share Posted October 29, 2006 Parse error: syntax error, unexpected '<' in /home/revoicc1/public_html/includes/reNews/ProcessNews.php(108) : eval()'d code on line 1 Quote Link to comment https://forums.phpfreaks.com/topic/25459-variables-inside-of-variables/#findComment-116172 Share on other sites More sharing options...
.josh Posted October 29, 2006 Share Posted October 29, 2006 read the part in the manual about mixing html with php code Quote Link to comment https://forums.phpfreaks.com/topic/25459-variables-inside-of-variables/#findComment-116177 Share on other sites More sharing options...
rempires Posted October 29, 2006 Author Share Posted October 29, 2006 thanks for everyones help, it was the eval function, i jsut wasn't using it right, still don't get howcome it did what it did, but i guess i'll look into it more alter, it's 2am here....btw code was[quote]eval("\$HeaderFormat = \"$HeaderFormat\";");[/quote]i'll figure out why tommorrow, thanks again for all the help Quote Link to comment https://forums.phpfreaks.com/topic/25459-variables-inside-of-variables/#findComment-116178 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.