PHP content stored in the database...

Ok, I have a site that I want the content stored in the database. Basically I have a “SHELL” of a page that has all the navigation and what not, but the MAIN section of the page that will change is stored in the database (as a text field.)

What I do is when the page is called I get that content and use that in the code inserted in the appropriate spot.

[php]

//Top bar Navigation stuff code

// Side bar navigation stuff code

// Main section stuff

<?php $sql = "SELECT title, content FROM pages WHERE page = '$page'"; $result = mysql_db_query('TABLE', $sql); $data = mysql_fetch_assoc($result); $content = $data['content']; $title = trim($data['title']); echo $content; ?>

// Footer stuff here

[/php]

Now my dilemma is that in the $content variable I also have MORE php code (for a page counter basically) but instead of being processed as PHP it’s just echoed out.

How do I get it to process as php?

eval(’?>’.$content) instead of echo $content

worked like a champ…

Thanks.

Sponsor our Newsletter | Privacy Policy | Terms of Service