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:[EMAIL PROTECTED]]
Sent: Thursday, August 23, 2001 12:15 PM
To: [EMAIL PROTECTED]
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: [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]