Jump to content

[SOLVED] DB Records Retrieved Out Of Order


refiking

Recommended Posts

I am trying to retrieve the records in order by the did field.  For some reason it retrieves the first one and then skips to the record with a did of 10.  Here is my code:

 

$sql = mysql_query("SELECT * FROM dregs WHERE lid = '$lid' AND sid = '$sid' AND tm = '' ORDER BY did LIMIT 3");

It sounds like the numbers may be saved in your database as text - if that is the case, then when you order it, it will order like this♦:

 

1

10

11

12

13

14

15

16

17

18

19

2

20

21

22

...etc

 

They will only order as 1,2,3,4,5 etc if they are saved as numbers.

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.