Running php code inside mysql calls
Date: 04/11/06
(PHP Community) Keywords: php, mysql, database, sql
I'm trying to parse PHP code that is echoed from a MySQL database. Right now, it just prints the php code onto the page--how exactly would I parse this code to actually run? For example, my function would be:
function image($imagename,$imagealign,$imagecaption)
{ echo "
$imagecaption"; }
And I want it to parse this out everytime I'd call the code, using (Keeping in mind that this is stored as text in a MySQL database--which plainly prints the italicized code rather than parses it)
Also, how do I get the filename of my current file? Say I'm at http://blahblahblah.com/blah/info.php and I want just "info.php" rather than "blah/info.php"--what code snippet would I use?
Thanks!
Source: http://community.livejournal.com/php/437965.html