Specific ordering of records based on list of IDs? with MySQL & PHP
- by Mr
I have a 'user' table in MySQL
When users login to my app, they can see a list of all other users and via some javascript-drag-drop can arrange which order the other users appear in. We want to save that order.
And it is saved to their record (i.e. 'order_pref' = 4,3,5,23... list of user_ids in the order they specified).
So that's fine but when it comes to displaying.. Is there an easy way I can sort based on this comma delimited list of user_ids using just one query?