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
https://forums.phpfreaks.com/topic/174921-write-php-from-mysql-field/
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.

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?

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.