Re: how to parse php code stored in databases?
| From: | Torsten Roehr | Date: | Sat, 08 May 2004 12:57:03 +0000 |
| Subject: | Re: how to parse php code stored in databases? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-34305@lists.php.net to get a copy of this message | ||
"Florian Wagner" <fw2001@gmx.net> wrote in message
news:20040508105441.27062.qmail@pb1.pair.com...
> Hi there,
> I thought it would be a great idea to store the code of nearly all my web
> pages in "text" fields of a mysql database.
> Now I've got the problem that I want to use php in those pages.
> Let's say $row["content"] contains the string "<? echo 'Hello
> World!' ?>".
> Then echo $row["content"] only produces the unparsed <? echo 'Hello
World!'
> ?> which effectivly displays nothing, because the browser doesn't know the
> "<?" tag. How can I tell PHP to parse this string before displaying it???
>
> Thanks for any suggestions...
This can be done with eval():
http://de.php.net/manual/en/function.eval.php
Take a look at the user comments there, especially regarding the inclusion
of <? and ?>.
Regards, Torsten