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

Popular posts from this blog

c# - Move local mssql database to webhosted MYSQL -

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -