I'm trying to SELECT from an array inside a mysql query
result = mysql_query("
SELECT * FROM fruit_db
WHERE fruit='".$url."'
")
$url has been created by $_GET and exploded into an array. It can be 'apple' or 'apple,banana,orange' for example. Not sure whether to implode back into string or not.
I need to be selecting 'apple' OR 'banana' OR 'orange', not 'apple,banana,orange'.
I'm used to counting the elements of the string, and looping through them, but not inside a mysql query, I can't work out if there's a simple way. I've tried something like
/*
result = mysql_query("
SELECT * FROM fruit_db
WHERE fruit='".$url[0]."'
OR fruit='".$url[1]."'
// etc
")
*/
but I don't know how many elements there will be