By default the evaled code is php, so you need to escape first: eval('?>'.$your_code_pulled_from_db.'<?php');
Michael Winston wrote:
I've been working on this for a few days and can't get it.
I would like to stick some php code into a sql databases and be able to evaluate it when it's called up.
Foe example, let's say there's some text in a table in MySql that says "blah blah blah <? $mysql_query("SELECT * FROM X WHERE 1); $someothercode; ?> blah blah blah blah blah". I wan the end, displaying result to be: "blah blah blah {executed php code} blah blah blah blah".
Now, I know that eval() is involved, but I don't want it accidentally executing code outside the "<? ?>" so I need a way to pluck out bits of code, evaluate them, and put them back in.
Any ideas?
Thanks, Michael
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php