|
-
YH Jelly Llama Jockey
hello, proably quite simple but hope you can help with out too much ridicule.....
I am doing a php/mysql query that returns a column of numbers ordered by their id. At the moment it is sorting it numerically but is sorting it like this:
1
11
12
15
19
2
20
21
22
23
27
3
30
31
4
5
6
but I want 1,2,3,4,5,6,7,8,9,10,11 etc etc
what am I doing wrong?
-
Hi,
if it is mysql sorting them with an order by, you probably have declared the id as a text rather than numeric column.
If you are sorting in php, try
sort($array, SORT_NUMERIC)
at least this is what I get from RTFM ...
Musicman
-
YH Jelly Llama Jockey
hmm, I've already set ID to be "int" but it makes no difference.
I probably AM asking for trouble having a footer like that aren't i.
-
Hi,
honestly - it just seems to work everywhere else. You are sure that you ORDER BY id ?
Musicman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|