Jump to content

String Variable - / - Procedure Storage....?


dcyuri7

Recommended Posts

I've been attempting to research how to do this, but I am
having very little luck. Basically, I am trying to run PHP code
from a mysql returned string. Looks like this:

[code]<?php
// Database Connect (not typed fully - no need for you to see it, or me to type it)
init_db.... and connection_of_db/ etc

// Request info (dont mind this too much either - except for the "Content_Main" var)
$sql_query=mysql_query("SELECT * FROM contentareas WHERE Page='{$_GET['id']}' AND SetName='Main'");
  $Content_Main=mysql_result($sql_query,0,"Data");

// If I were to echo Content_Main, it would show this:
echo "echo \"<p class=\\"secondary\\">; print \"Hello World\"; echo \"</p>\";";

// Heres my problem!!
unknown_PHPfunction($Content_Main);
// I want it to execute the code in the stored String, which happens to be most specifically:
// print \"Hello World\";  -- And of course the two echo's surrounding it.

[/code]

Any help is greatly appreciated,
yuri

Link to comment
https://forums.phpfreaks.com/topic/36397-string-variable-procedure-storage/
Share on other sites

lol looks like people are discouraged cause i made it complicated...
All i need to do is:
take $string;
$string='echo "Bla";'
then:
some_cmd($string);

Just need to run a php command using a string variable.
Kind of like an include(); except not with files, with variables. ;)

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.