vanderlay Posted November 15, 2006 Share Posted November 15, 2006 hi All,I have a mysql field that contans html code that is echo'd thru a php page, iedb field = <h1>this is page content</h1>[code]$myseldb = mysql_select_db($database, $db1); $query = "SELECT * FROM pages WHERE html = '$pagenum' "; $recset = mysql_query($query, $db1) or die(mysql_error()); $html = mysql_result($recset, 0, 'pages_html');echo $html;[/code]and works fine generating the html code as expected,I now need to add some extra php code to do a require, ie db field = <h1>this is page content</h1> <?php require $_SERVER["DOCUMENT_ROOT"].'/extrastuff.php'; ?>how do i use the eval to parse the html and PHP code then echo it as normal, or is there a better funct then eval,i have tried this code with no luck[code]eval("\$html = \"$html\";");echo $html;[/code]thanksArt Quote Link to comment Share on other sites More sharing options...
trq Posted November 15, 2006 Share Posted November 15, 2006 Chances are if your storing php within a database then you have made a poor design choice in the first place. You may however be able to work around your mistakes using output buffering. Take a look at [url=http://php.net/ob_start]ob_start[/url] and its related functions. Quote Link to comment Share on other sites More sharing options...
vanderlay Posted November 15, 2006 Author Share Posted November 15, 2006 [quote author=thorpe link=topic=115026.msg468214#msg468214 date=1163559835]Chances are if your storing php within a database then you have made a poor design choice in the first place. You may however be able to work around your mistakes using output buffering. Take a look at [url=http://php.net/ob_start]ob_start[/url] and its related functions.[/quote]Thx for the direction Thorpe, however I fail to see your connection to how this helps me. Can you provide a little more detail on what functions i can use that will parse the content of the db field so the html is echo'd and the php is processed rather than written to screen as text.thx againArt Quote Link to comment Share on other sites More sharing options...
Jenk Posted November 15, 2006 Share Posted November 15, 2006 You do realise that you won't see any difference with that eval'd code?[code=php:0]$html = $html;[/code] Quote Link to comment Share on other sites More sharing options...
Orio Posted November 15, 2006 Share Posted November 15, 2006 you should have instead of:eval("\$html = \"$html\";");echo $html;This- eval($html);Orio. Quote Link to comment Share on other sites More sharing options...
Jenk Posted November 15, 2006 Share Posted November 15, 2006 or just..[code=php:0]echo $html;[/code]if all it contains is HTML markup. Quote Link to comment Share on other sites More sharing options...
vanderlay Posted November 15, 2006 Author Share Posted November 15, 2006 thx guys, Orio I will give this a go, Jenk, I do have more than just HTML code as the code comes from several sources it may contain a variety of php functs from date/time to who knows what so the processing is important, security is not an issue as this is internal for testing different setups Art Quote Link to comment Share on other sites More sharing options...
trq Posted November 15, 2006 Share Posted November 15, 2006 Man... I must have been in a mood ths morn. Sorry If my comments where a little harsh man. Quote Link to comment Share on other sites More sharing options...
vanderlay Posted November 15, 2006 Author Share Posted November 15, 2006 NP ;) Quote Link to comment 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.