steveangelis Posted September 5, 2009 Share Posted September 5, 2009 I currently have a list showing off a sequence of numbers coming from a database. It is pretty straight forward, row 1 has a 1, row 2 has a 2 row 3 has a 3 and so on. The problem is when it gets to row 10, 10 gets put right below 1 such as this: 1 10 11 12 2 3 4 5 Does anyone know how to make this so the numbers are in the correct order? Link to comment https://forums.phpfreaks.com/topic/173271-solved-numbers-and-order/ Share on other sites More sharing options...
steveangelis Posted September 5, 2009 Author Share Posted September 5, 2009 Never mind found it Link to comment https://forums.phpfreaks.com/topic/173271-solved-numbers-and-order/#findComment-913355 Share on other sites More sharing options...
scanreg Posted September 6, 2009 Share Posted September 6, 2009 What was your solution? (Would be good for those who need to figure this out as well) Thanks Link to comment https://forums.phpfreaks.com/topic/173271-solved-numbers-and-order/#findComment-913397 Share on other sites More sharing options...
PFMaBiSmAd Posted September 6, 2009 Share Posted September 6, 2009 He put integers into an INT data type instead of a character/text type so that they would be treated as integers instead of strings. Link to comment https://forums.phpfreaks.com/topic/173271-solved-numbers-and-order/#findComment-913400 Share on other sites More sharing options...
scanreg Posted October 23, 2009 Share Posted October 23, 2009 Something like: echo intval($values); Link to comment https://forums.phpfreaks.com/topic/173271-solved-numbers-and-order/#findComment-942805 Share on other sites More sharing options...
PFMaBiSmAd Posted October 23, 2009 Share Posted October 23, 2009 The result is due to what the query operates on. The solution is either to use a correct definition for the column or force the query to treat the values as integers in the query. Using intval() or any other php code would not affect what the query does and would not work. Link to comment https://forums.phpfreaks.com/topic/173271-solved-numbers-and-order/#findComment-942829 Share on other sites More sharing options...
scanreg Posted October 29, 2009 Share Posted October 29, 2009 Thanks, it's becoming clear in my newbie brain to use the mysql features as much as possible when interacting with the db, thanks again Link to comment https://forums.phpfreaks.com/topic/173271-solved-numbers-and-order/#findComment-947117 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.