select query for array of ids mysql
by Ramya[ Edit ] 2014-03-05 15:10:45
select query for array of ids mysql :
Sometimes, you need to fetch ids in an array format and select the fields from table based on those ids. For this case, you need not write for/foreach loop, get ids one by one and select the fields based on it.....
Just use MySQL "IN" statement to get all those ids in array,
$dispRun = 'SELECT * FROM WHERE id IN (' . implode(",", $passArrId) . ')';
This saves your time, line of code and get rid of looping concept to fetch the array of ids mysql.