Re: PHP Parse MySQL Field???

From: Date: Sat, 20 Jan 2001 09:27:12 +0000
Subject: Re: PHP Parse MySQL Field???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35792@lists.php.net to get a copy of this message
>I have a BLOB field in a MySQL database that I want >to parse into my page using PHP. >For instance, in this field might be the following: > ><? echo "test"; ?> > >So when I access this field in PHP I want it to display "test". > >Is this possible? Yeah. That's called "eval" (short for 'evaluate') Basically you can make PHP execute arbitrary chunks of more PHP code. NOTE: Letting web-surfers insert PHP code into your database to be evaluated later is really high on the Bad Idea list... Actually, doing this on a web-site where you're not pretty sure the database itself is pretty secure from not only surfers but also other potentially malicious co-users on the same box... It's just too easy for them to be able to put mean code in your database... http://php.net/eval I *think* it goes like this: <?php $php = 'echo "Hi";'; eval($php); ?> Never used it myself... By Day: |By Night: Don't miss the Zend Web Store's | There's not enough room here... Grand Opening on January 23, 2001! | Start here: http://www.zend.com | http://l-i-e.com/artists.htm

« previous php.general (#35792) next »