RE: [PHP-DB] variable if statement

From: Date: Thu, 23 Aug 2001 17:27:36 +0000
Subject: RE: [PHP-DB] variable if statement
Groups: php.db 
Request: Send a blank email to php-db+get-11736@lists.php.net to get a copy of this message
eval will work, but the entire thing must be in the eval(). It would look like: $flag = 0; $test = "(a==1) OR (b==1)"; $string = "if($test){ $flag =1;}"; eval($string); if( $flag ==1 ) {do_something;} I had to resort to this in a similar situation. I read the condition and result action in a MySQL database. Richard Emery Excel Communications, Inc. IT Sr. Project Manager (972) 478-3398 (972) 944-0542 (pager) There is no "trying"... There is only "Do" or "Not Do" -----Original Message----- From: Brian Weisenthal [mailto:bsw10@cornell.edu] Sent: Thursday, August 23, 2001 12:15 PM To: php-db@lists.php.net Subject: [PHP-DB] variable if statement i want to do something like this: $string="($a==1) OR ($b==2)"; if ($string) { do something ; } any ideas? i tried using if (eval($string)) but that just gave me errors. thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#11736) next »