Multiple search parameters in PHP -
Multiple search parameters in PHP -
i have form allows several different search alternative inputs. such text boxs , drop downs. of search waiting search request , seeing if there character input in various text boxes or drop downwards alternative selected.
basically branches of conditional logic using if statements modifying sql statement depending chosen. how can create supports single options or several linked together?
example of current condititional logic
$sql = "select "; if(strlen($_request['option1']) > 0) { $sql .= "* table option1 = {$_request['option1']} "; } if(strlen($_request['option 2']) > 0) { $sql .= "* table option2 >= {$_request['option2']}";
i understand need utilize , in sql query. tried arrays of options looping through depending on boolean state didn't work
put clauses in array implode or or and:
$sql .= implode(" , ", $wherearray);
php
Comments
Post a Comment