Jump to content

I want to select the highest scores from a database


Rosst

Recommended Posts

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.
I use the same thing, it doesn't work, except I have asc instead on desc
[code=php:0]<?php
include("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]
I'm sorry, it's limit 0,5

You would probably want the top scores in descending order.  That is how most video games do it.

1.  Player 1    50,000
2.  Player 2    40,000
3.  Player 3    30,000
4.  Player 4    20,000
5.  Player 5    10,000
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"
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.