Home     Articles & Projects     Products & Web Services

Storing and running PHP code in MySQL

Hi All,
just wondering if anyone might be able to help me, I am storing the following code in a MYSQL table

<?php
if($_GET['success'] == 1)
{
print
"Hello";
}
?>

However when i print this on a page using

<?php
eval('?>
' . $stories[2]['html'] . '<?php ');
?>

and I go to http://www.example.com/?success=1

it does not run the PHP code.

Hi Russell, No need for the

Hi Russell,

No need for the PHP tags in your call to eval() if they are already in the value that you have read from the database. Have a go with just;

<?php
eval($stories[2]['html']);
?>

Hope this helps!