Jump to content

Archived

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

Rosst

I want to select the highest scores from a database

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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
It is in descending order right now, and it doesn't look like it should, none of you are helping me!

Share this post


Link to post
Share on other sites
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"

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

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.