I have string containing a lot of IDs corresponding to my database. Like:
1,2,3,4,5
I then do a mySQL query to select all those rows:
You might use order by with case ... end, though part between case and end should be generated by PHP:
order by
case ... end
case
end
select * from table where id in (2, 1, 3, 4, 5) order by case id when 2 then 1 when 1 then 2 when 3 then 3 when 4 then 4 when 5 then 5 end asc