In our current application, I have a report that contains something like:
if($foo == 3 || $bar > 3) { $e = someFunction(); };
but for another client, the same expression might be:
if($foo == 3 || $bar == 5 && $foobar != 9) { $e = someFunction(); };
Is there a direct way to save two different expressions, just
$foo == 3 || $bar > 3 OR $foo == 3 || $bar == 5
in the database (MySQL), so I donβt need to hard-code all of these rules by the client or support client versions of the same report. I am trying to figure out if I can set the variable o to replace the conditions. Something like:
$conditions = $row_rsConditions['condition_row'] //Get $foo == 3 || $bar > 3 from the DB and store it as $conditions if($conditions) { $e = someFunction(); };
There may be> 100 different clients, and each client may / will have a different set of expressions. I'm just not sure about the right / best way to do this.
UPDATE
I think I understand the problems using the PHP function eval (). But due to the number of possible combinations, I tend to use a database to store conditions (not sure if eval () is still used)
It does not matter (safer) if there is no interface facing the user who writes the conditions / table in the field? It may be something that we can only do on our side.
Jason
source share