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
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. ;)
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.