fazzfarrell Posted January 29, 2007 Share Posted January 29, 2007 I have a forum running where the results are in order by ID.My problem is as soon as the id hits '100' the result goes to the bottom instead of being the first result.The data base starts at 1 (which appears last)any one help? Link to comment https://forums.phpfreaks.com/topic/36163-solved-id-problem/ Share on other sites More sharing options...
ted_chou12 Posted January 29, 2007 Share Posted January 29, 2007 Oh, that is because the problem with how mysql sorts its result, have a look at this:http://au3.php.net/manual/en/function.strnatcmp.phpmaybe you will have to use php code to retrieve all the results, put them into an array, and then use this function strnatcmp() to echo them out one by one.Ted Link to comment https://forums.phpfreaks.com/topic/36163-solved-id-problem/#findComment-171702 Share on other sites More sharing options...
trq Posted January 29, 2007 Share Posted January 29, 2007 Don't rely on an id (auto-increment) to sort your results, that is not there intended purpose. Make a field of timestamp type and use that. Link to comment https://forums.phpfreaks.com/topic/36163-solved-id-problem/#findComment-171711 Share on other sites More sharing options...
ted_chou12 Posted January 29, 2007 Share Posted January 29, 2007 actually, i dont think you need to use order by with id column, because the query automatically sorts the results by the primary id column.Ted Link to comment https://forums.phpfreaks.com/topic/36163-solved-id-problem/#findComment-171716 Share on other sites More sharing options...
fazzfarrell Posted January 29, 2007 Author Share Posted January 29, 2007 donr this by date and now it seems to be working fine, thanks Link to comment https://forums.phpfreaks.com/topic/36163-solved-id-problem/#findComment-171730 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.