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:
Another option, though FIELD is probably the way to go in your case:
FIELD
SELECT * FROM `table` WHERE `id` IN (2,1,3,4,5) ORDER BY `id` = 2 DESC, `id` = 1 DESC,`id` = 3 DESC, `id` = 4 DESC, `id` = 5 DESC