While working on my game site I had to order related games by relevance where I had game ids as string in needed order. If I do regular mysql query
SELECT * FROM games WHERE id IN(1,3,2);
I get result as 1,2,3. To get result in 1,3,2 custom order mysql query should be as following.
SELECT * FROM games WHERE id IN (1,3,2) ORDER BY FIELD(id, 1,3,2);
Start your Classifieds website Today!
Build online community using our responsive classifieds script