Jump to content

how to treat TEXT from mysql as a PHP code


renoor

Recommended Posts

hello,

this is my first post and also first problem I was unable to find through google...

 

I need a page that can generate it's content completely dynamically, so in database i have objects like image, text, gallery and one special "custom" object - this should be any code in PHP that i want to execute during page generation.

So basically, I need something like this:

 

$query="SELECT * FROM subcat WHERE cat = $cat";
$result=mysql_query($query);
if (mysql_numrows($result) > 0)
    $i=0;
    while ($i < $num) {
        if (mysql_result($result,$i,"type") == "custom")
            include (mysql_result($result,$i,"content));
    }

 

of course, the 'include' statement is wrong because i'm not supplying a filename with some content, but a content itself.

a workaround should be to create a temporary file and include it, but I think it is an ugly solution...please can you help me with this?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.