Re: embedding PHP in MySQL
| From: | Marek Kilimajer | Date: | Thu, 18 Sep 2003 15:44:15 +0000 |
| Subject: | Re: embedding PHP in MySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163018@lists.php.net to get a copy of this message | ||
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