Forum Moderators: coopster
this is quite difficult to explain, but is there any way to use WHERE = array in php, e.g.
$array[] = 23;
$array[] = 334;
$array[] = 20;
$array[] = 64;
$sql = "SELECT FROM Website_table WHERE ID=$array";
Will this work? e.g. the above query should return rows where ID = 23 or 334 or 20.
What about?
$sql = "SELECT FROM Website_table WHERE ID=$array[o] OR ID=$array[1] OR ID=$array[2]";
I can't find any other way to do this because i am already using a while loop to generate the array and then i want to match everything in the array but i cannot use another wile loop! This probably doesn't make any sense..
and then i want to match everything in the array but i cannot use another wile loop! This probably doesn't make any sense..
in this case, yes. however, imagine there were like 100 id's to lookup. unless you got a direct relationship to the numbers you would have to go while looping ;)