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
https://forums.phpfreaks.com/topic/4579-echo-a-php-script/
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
https://forums.phpfreaks.com/topic/4579-echo-a-php-script/#findComment-16019
Share on other sites

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.