pioneerx01 Posted June 10, 2011 Share Posted June 10, 2011 I have a query that shows me all the records in the table. Nothing I have not done before. I have 20 unique records there at this time. When I run a query to show me all records in the table it displays all 20 records. If I tell it to order them ASC by ID it shows records 1-20 as it should. If I tell it to order them DESC by ID is shows records 19-1, but not 20. I have to add record 21 to see record 20 in the query, but I will not see record 21. WHY? Quote Link to comment https://forums.phpfreaks.com/topic/238931-when-i-do-order-by-id-desc-i-am-missing-a-record/ Share on other sites More sharing options...
ryanfilard Posted June 10, 2011 Share Posted June 10, 2011 ORDER BY ID DESC "id" is uppercase it should be like this ORDER BY id DESC I had this issue once Quote Link to comment https://forums.phpfreaks.com/topic/238931-when-i-do-order-by-id-desc-i-am-missing-a-record/#findComment-1227751 Share on other sites More sharing options...
PFMaBiSmAd Posted June 10, 2011 Share Posted June 10, 2011 Your php code is probably fetching and discarding one row or your query is doing something to cause one row to not be matched. If you want help with something you are doing that does not work, you must post the query and code responsible for the symptoms. Quote Link to comment https://forums.phpfreaks.com/topic/238931-when-i-do-order-by-id-desc-i-am-missing-a-record/#findComment-1227754 Share on other sites More sharing options...
pioneerx01 Posted June 10, 2011 Author Share Posted June 10, 2011 Sorry ryanweekly it was not as easy, I have tried that too. PFMaBiSmAd you are correct I had this running : $result = mysql_query('SELECT * FROM galleries ORDER BY id DESC'); $row = mysql_fetch_array($result); while($row = mysql_fetch_array($result)){ and I need only this: $result = mysql_query('SELECT * FROM galleries ORDER BY id DESC'); while($row = mysql_fetch_array($result)){ Stupid me .... Quote Link to comment https://forums.phpfreaks.com/topic/238931-when-i-do-order-by-id-desc-i-am-missing-a-record/#findComment-1227755 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.