Rosst Posted October 5, 2006 Share Posted October 5, 2006 I want to select the highest scores from a database, it's from a PHP/MySQL/Flash snake game, see here: http://vexxon.net/index.php? the bottom right content thingy has the snake high scores, but it's not in order, how would I put them in order?Thanks in advance for the help. Quote Link to comment https://forums.phpfreaks.com/topic/23043-i-want-to-select-the-highest-scores-from-a-database/ Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 Using SQL order by. [code]SELECT * FROM high_scores ORDER BY score DESC LIMIT 5[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23043-i-want-to-select-the-highest-scores-from-a-database/#findComment-104080 Share on other sites More sharing options...
Rosst Posted October 5, 2006 Author Share Posted October 5, 2006 I use the same thing, it doesn't work, except I have asc instead on desc[code=php:0]<?phpinclude("config.php");$a = mysql_query("select * from snake order by score asc limit 5");while ($b = mysql_fetch_array($a)) {echo "<a href=\"index.php?id=memb&user=".$b[uname]."\">".$b[uname]."</a> - ".$b[score]."<br />";}if ($logged[username]) {echo "Play snake: <a href=\"snake/snake.swf\">Link</a>";}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23043-i-want-to-select-the-highest-scores-from-a-database/#findComment-104088 Share on other sites More sharing options...
markbett Posted October 5, 2006 Share Posted October 5, 2006 you are using ASC dont you want DESC Quote Link to comment https://forums.phpfreaks.com/topic/23043-i-want-to-select-the-highest-scores-from-a-database/#findComment-104089 Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 I'm sorry, it's limit 0,5You would probably want the top scores in descending order. That is how most video games do it.1. Player 1 50,0002. Player 2 40,0003. Player 3 30,0004. Player 4 20,0005. Player 5 10,000 Quote Link to comment https://forums.phpfreaks.com/topic/23043-i-want-to-select-the-highest-scores-from-a-database/#findComment-104090 Share on other sites More sharing options...
Rosst Posted October 5, 2006 Author Share Posted October 5, 2006 It is in descending order right now, and it doesn't look like it should, none of you are helping me! Quote Link to comment https://forums.phpfreaks.com/topic/23043-i-want-to-select-the-highest-scores-from-a-database/#findComment-104091 Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 I assure you we are trying. You can hardly get mad at free help. What is the problem? Quote Link to comment https://forums.phpfreaks.com/topic/23043-i-want-to-select-the-highest-scores-from-a-database/#findComment-104103 Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 What is the data type of the field containing the score? Quote Link to comment https://forums.phpfreaks.com/topic/23043-i-want-to-select-the-highest-scores-from-a-database/#findComment-104106 Share on other sites More sharing options...
markbett Posted October 5, 2006 Share Posted October 5, 2006 lol the irony that you have PHP tutorials on your site... well that and your flash logo is illegable...just so you know descending means it starts big and gets small at this very moment the list isnt in desc order.... furthermore you will need to explain WHAT is not working... saying ITS NOT WORKING will do no good and is the reason why "none of (us) are helping you" Quote Link to comment https://forums.phpfreaks.com/topic/23043-i-want-to-select-the-highest-scores-from-a-database/#findComment-104126 Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 I think he has DESC but has a string data type, so they are all equal, and displaying in the order they were entered into the database. Quote Link to comment https://forums.phpfreaks.com/topic/23043-i-want-to-select-the-highest-scores-from-a-database/#findComment-104131 Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 Just so you know, using plain text as a CAPTCHA doesn't secure it at all, because anyone who was automating the registration process (presumably what you are trying to avoid, or does it just look cool?) could easily read that text from the page with a computer. That is the idea behind CAPTCHA: Completely Automated Public Turing test to tell Computers and Humans Apart. Check this:http://evolt.org/securing_forms_random_image Quote Link to comment https://forums.phpfreaks.com/topic/23043-i-want-to-select-the-highest-scores-from-a-database/#findComment-104135 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.