ohdang888 Posted January 18, 2008 Share Posted January 18, 2008 $new_games = mysql_query("SELECT game_picture_url, type, title, counter FROM game ORDER BY counter DESC LIMIT 18") or die(mysql_error()); i want the counter with the biggest number first, but its not doing it. it works, its just not ordering right Quote Link to comment https://forums.phpfreaks.com/topic/86567-solved-mysql-ordering/ Share on other sites More sharing options...
Nhoj Posted January 18, 2008 Share Posted January 18, 2008 Try: $new_games = mysql_query("SELECT `game_picture_url`, `type`, `title`, `counter` FROM `game` ORDER BY `counter` DESC LIMIT 18") or die(mysql_error()); I'm not sure if any of those column names are reserved for MySQL, its generally good practice to encase them in a ` Quote Link to comment https://forums.phpfreaks.com/topic/86567-solved-mysql-ordering/#findComment-442321 Share on other sites More sharing options...
revraz Posted January 18, 2008 Share Posted January 18, 2008 What is in the counter field in your DB? Give some examples. Quote Link to comment https://forums.phpfreaks.com/topic/86567-solved-mysql-ordering/#findComment-442325 Share on other sites More sharing options...
ohdang888 Posted January 18, 2008 Author Share Posted January 18, 2008 nvm, i changed it from VARCHAR to INT, my bad... anyways, i have another problem... it is good to use a "timestamp" for a "date_joined" column? because i'm pretty sure that i added a certain row a few days ago, and its coming up as today. Quote Link to comment https://forums.phpfreaks.com/topic/86567-solved-mysql-ordering/#findComment-442394 Share on other sites More sharing options...
ohdang888 Posted January 18, 2008 Author Share Posted January 18, 2008 oh. i get it. it changes the time every time that row is searched for. what should i use to create a time for "date joined" ???? Quote Link to comment https://forums.phpfreaks.com/topic/86567-solved-mysql-ordering/#findComment-442396 Share on other sites More sharing options...
revraz Posted January 18, 2008 Share Posted January 18, 2008 How are you storing it, Unix Time or SQL Date/time? Use INT for Unix, use SQL Date or DateTime depending on what you want. Quote Link to comment https://forums.phpfreaks.com/topic/86567-solved-mysql-ordering/#findComment-442398 Share on other sites More sharing options...
ohdang888 Posted January 18, 2008 Author Share Posted January 18, 2008 mysql, its solved thanks! Quote Link to comment https://forums.phpfreaks.com/topic/86567-solved-mysql-ordering/#findComment-442406 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.