8utt
Wed 8th Nov '06, 12:11pm
I have a field in my users table which contains a comma seperated list of values corresponding to the ids of another table.
What I need is a mysql query that will give me the table contents in the order of the seperated list.
An example is.
user.pictures = 0,5,8,4,2,7,90,87
in the php I give this the value $userpictures
I want a query which looks like
select * from pictures where id IN $userpictures
The problem is that it returns the pictures but in the order 0,2,4,5,7,8,87,90
Is there a way of returning the data in the same order as it is listed in the user table field ?
Hope this makes sence.
Many Thanks
What I need is a mysql query that will give me the table contents in the order of the seperated list.
An example is.
user.pictures = 0,5,8,4,2,7,90,87
in the php I give this the value $userpictures
I want a query which looks like
select * from pictures where id IN $userpictures
The problem is that it returns the pictures but in the order 0,2,4,5,7,8,87,90
Is there a way of returning the data in the same order as it is listed in the user table field ?
Hope this makes sence.
Many Thanks