Forum Moderators: coopster

Message Too Old, No Replies

Execute PHP retrieved from MySQL

         

JAB Creations

4:11 pm on Sep 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd like to know how to execute PHP code that is stored in MySQL and retrieved via PHP...

- John

<?php
$query = "SELECT xhtml FROM table";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);

echo $row['xhtml'];

// $row['xhtml'] would contain...
//'<p><?php echo 'simple example';?></p>'
?>

Frank_Rizzo

6:21 pm on Sep 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you need eval()

eval($row['xhtml']);

JAB Creations

8:31 pm on Sep 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Awesome! Thanks Frank!

- John