djfox Posted December 7, 2007 Share Posted December 7, 2007 I have a code to display items via listing their price by lowest to highest (ORDER BY sellprice ASC). Technically this works. Say we have 5 items: Item 1: 50 Item 2: 10 Item 3: 45 Item 4: 100 Item 5: 60 It displays the items like this: Item 2: 10 Item 4: 100 Item 3: 45 Item 1: 50 Item 5: 60 This is the display I want: Item 2: 10 Item 3: 45 Item 1: 50 Item 5: 60 Item 4: 100 I`ve seen other websites that can do this but I can`t figure out how to do this. Quote Link to comment Share on other sites More sharing options...
trq Posted December 7, 2007 Share Posted December 7, 2007 What field type is sellprice? Quote Link to comment Share on other sites More sharing options...
djfox Posted December 7, 2007 Author Share Posted December 7, 2007 varchar Quote Link to comment Share on other sites More sharing options...
trq Posted December 7, 2007 Share Posted December 7, 2007 Theres your problem. It is sorting as expected, alphabeticaly, because your using a string type. You need to use an int type if you expect to sort numbers naturally. Quote Link to comment Share on other sites More sharing options...
djfox Posted December 7, 2007 Author Share Posted December 7, 2007 Oh my goodness, how stupid of me. Thanks very much for the help. Quote Link to comment 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.