Jump to content

Sorting output


aeris130

Recommended Posts

Here's my query:

[code]SELECT * FROM table WHERE column LIKE \"%$trimmed%\" AND approved='yes'
  ORDER BY number ASC[/code]

"number", is a column that stores a certain number (VARCHAR 10, other then ID) that's unique. These numbers range from 1 to 999. The problem is, that the results are sorted based on the first digit, not the entire number.

Say I have these numbers: 1, 2, 4, 8, 9, 25, 88, 106 and 305.

The results get sorted like this:
[code]
1

106

2

25

305

4

8

88

9[/code]

But I want to store them in the correct order (1, 2, 4, 8, 9, 25, 88, 106 and 305).

How do I solve this?
Link to comment
https://forums.phpfreaks.com/topic/5359-sorting-output/
Share on other sites

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.