RE: [PHP] embedding PHP in MySQL
| From: | Javier Tacon | Date: | Thu, 18 Sep 2003 15:30:49 +0000 |
| Subject: | RE: [PHP] embedding PHP in MySQL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-163016@lists.php.net to get a copy of this message | ||
Instead to eval the code, try to save the query result into a new file, then execute this file
(require_once, include).
Something like:
function executeFromQuery($query) {
global $DB;
$file = "/tmp/temp.php";
$code = $DB->getOne($query);
$fh = fopen($file,"w");
fwrite($fh,$code);
fclose($fh);
include($file);
}
It should work.
Javier Tacón Iglesias.
-----Mensaje original-----
De: Michael Winston [mailto:michaelw@darkhorse.com]
Enviado el: jueves, 18 de septiembre de 2003 17:20
Para: php-general@lists.php.net
Asunto: [PHP] embedding PHP in MySQL
Importancia: Baja
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