Forum Moderators: coopster
example:
$array[0] = "green";
$array[1] = "red";
$array[2] = "yellow";
then select all the rows where 'colour' is either red, green or yellow. but preferably without using OR in the query
i hope i've explained this properly....
SELECT * FROM you_table WHERE colour IN ('red','green', 'blue');
To build that query in PHP, you can use the implode function on your array like this:
$sql = "SELECT * FROM your_table WHERE colour IN ('".implode("','", $colour_array)."');";
Of course, make sure your $colour_array is not empty.
The quotes are a little tricky, but this should work.
Mav