Jump to content

Write PHP From MySQL Field?


R4nk3d

Recommended Posts

I'm making a very dynamic site and i can't seem to figure out how to take lines of php, write them onto a page, and have them output something. here's an example:

$mysqlfield = "<?php include('test.php'); ?>";

echo($mysqlfield);

 

 

But it doesnt write anything, am i able to do this?

Link to comment
Share on other sites

Ok, thanks. Ill look into it because I just changed it and it screwed up the script so Ill have to read up on that to know how to use it.

 

Thanks,

R4nk3d

it basically executes a string of php code.

 

$a = 'echo "Hello world!";';

eval($a);

 

That would output: Hello world!

 

There's also call_user_func("FunctionName", "Arguments"); if you need to call functions with a string.

Link to comment
Share on other sites

Ok, well i store pages in the mysql fields for the dynamic site and its kind of like this:

 

Welcome to <?php echo($title); ?>

 

 

so its a mix of php and html. Should i run a loop through the string and find the <?php parts of it and eval the string in between the <?php and ?> tags?

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.