mysql return rows in order of IN() Id's
if I have an array of mysql row Id's like this:
$id_array = array(5,3,13,7,12);
How can I tell mysql to retrieve the id's with the title while preserving
the order of the array.
i.e. something like:
$in = implode(',',$id_array);
$query = "SELECT `id`,`title` FROM table WHERE `id` IN($in) ORDER BY
(order of $id_array)"
No comments:
Post a Comment