Jump to content

Echo a PHP Script


MB Works

Recommended Posts

Hey.

Im having a problem, and i cant find the solution because i really dont know the command for do it.
I have a DB with scripts. For example

Table: Test, Column: Script, Row: <?php something ?>

I want to run that PHP code. But if i do and echo display "<?php something ?>";

[code]
$query = "SELECT * FROM codes";
$result = mysql_fetch_array($query, MYSQL_ASSOC);

echo $result['script'];
[/code]

Where script = "<?php something ?>"
And echo return "<?php something ?>" as HTML
I want to Run <?php something ?>

How i can run that PHP code before the HTML?

Thanks
Link to comment
Share on other sites

It worked, but now my problem is:
[code]
$var = "<table><tr><td><?php echo "dynamicvalue" ?></td></tr></table>";
echo eval($var);
[/code]

Return:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Parse error: parse error, unexpected '<' in functions.php : eval()'d code on line 1
[/quote]

eval only work if: [b]eval("echo dynamicvalue;")[/b]

Theres a way to run a Mixed Variable? or i need to filtrer all the code (god)

And Thanks for the reply
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.