Jump to content

When I do ORDER BY ID DESC I am missing a record


pioneerx01

Recommended Posts

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?

 

 

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.

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 ....

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.