That which is in an evel() must be valid PHP code. "?>" is not PHP, rather it terminates a PHP segment.
What ARE you trying to execute? I've used eval() with arguments extracted from a mySQL database many times with success. -----Original Message----- From: Richard A. Noordam [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 4:06 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] php-mysql-and the elusive eval statement.... I'm having a php/mysql problem using the eval statement. what I'm done is created a template that is database driven ie. the document is setup so that all of the head, leftside, body, right and bottom are all text comming from database query returns. all database returns are valid tested code. all peices have been tested in their own pages and shown to work. inside the text of the returns supposedly can be php code. using the eval statment i can get the html code to return no problem(page works correctly). when the code has php code in it it doesn't seem to work. using the eval statement I should be able to do something like eval ("?>$string") and it should evaluate the the code within thus when it comes to a <?php string it'll evaluate the next bit as php code. (right?) somehow it doesn't. here's a small snipit of the code. <?php // ************************** // Header of Document // ************************** eval ("?>$top"); ?> <center> </td> </tr> </table> </div> <div name="middle"> <table width="780" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="120" bgcolor="<?php echo $leftcolor;?>" border="0"> <div name="leftbar"> the inside code just goes out and grabs a counter value, updates it +1 and returns the original counter val. I get nothing(well I get a space, where somehthing is suppose to be returned). the code inside works also as independently in a page by itself it'll return valid counter information and does the update. I'm about ready to pull my hair out, (good thing my wife keeps it about 1/2 inch long, heh heh). tie all of my computers together with a big rope and use them as boat anchors..... (I don't even have a boat, so I'll just have to throw them in) so any help avoiding this costly situation would be appreciated.... thanks in advance R ------------------------------------------- Never, Never buy beer! Make it! It tastes better!! Woke up this mornin' an' I had myself a beer. Yea, Ah woke up this mornin' an' I had myself a beer. The futures' uncertain and the end is always near. -Jim Morrison, "Roadhouse Blues" Fill with mingled cream and amber, I will drain that glass again. Such hilarious visions clamber Through the chambers of my brain. Quaintest thoughts--queerest fancies, Come to life and fade away: I am drinking ale today. --Edgar Allan Poe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]