Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorverb
    • CommentTimeNov 7th 2006 edited
     permalink

    Hi,

    I’ve got a table in a SQL database, which has rows with details for every page on the site, like this:
    |id|title|meta_desc|meta_keywords|body|

    In my template, I have got something like this:

    <? $body = mysql_result($result,'',"body"); ?>
    <div id="content">
    <?=$body?>
    </div>

    So far so good, but here comes the problem: if I place some php code for e.g. a contact form in the body cell (in the database), it cannot be executed (because it’s “echoed”, obviously…). How can I place the contents of the “body” cell inside div#content in a way it can execute php code?

    • CommentAuthoreasement
    • CommentTimeNov 7th 2006
     permalink
    What if you did:
    <? eval($body) ?>

    However, you may need to convert the HTML into php by echo "GONTENT GOES HERE"; statements.
    • CommentAuthorverb
    • CommentTimeNov 7th 2006
     permalink

    That works. Thanks :-)

Add your comments
    Username Password
  • Format comments as (Help)