karthikeyan_coder Posted February 1, 2007 Share Posted February 1, 2007 i have an ordered list like.. 2, 3, 1, 6, 4, & 5 i have a query like $sql = "SELECT * FROM `table` WHERE `available`='Y'"; $query = mysql_query($sql); let us say this query returns 12 result rows. i need to get above result rows only in that order. is it possible? Link to comment https://forums.phpfreaks.com/topic/36678-nth-result-row-of-a-query/ Share on other sites More sharing options...
Ninjakreborn Posted February 1, 2007 Share Posted February 1, 2007 ORDER BY ASC will do it in ascending order ORDER BY DESC will do it in descending order if you put a limit on it, make sure you have the order by BEFORE you put the limit clause. Link to comment https://forums.phpfreaks.com/topic/36678-nth-result-row-of-a-query/#findComment-174872 Share on other sites More sharing options...
karthikeyan_coder Posted February 1, 2007 Author Share Posted February 1, 2007 No that ordered list is not available in the table. if it returns simply 12 rows then i have to take 2nd row,3rd row,1st,6th.. like that... Link to comment https://forums.phpfreaks.com/topic/36678-nth-result-row-of-a-query/#findComment-174947 Share on other sites More sharing options...
karthikeyan_coder Posted February 1, 2007 Author Share Posted February 1, 2007 select * from sometable orderby (asc/desc) limit n,1 Trying this now Link to comment https://forums.phpfreaks.com/topic/36678-nth-result-row-of-a-query/#findComment-174948 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.