paulman888888 Posted May 30, 2008 Share Posted May 30, 2008 hi, Below is uploadscore.php <?php // Insert a row of information into the table "example" mysql_query("INSERT INTO example (name, score) VALUES('" . mysql_real_escape_string($_GET['name']) . "', '" . mysql_real_escape_string($_GET['score']) . "')") or die('Theres an error. Please try again.#'); echo "Score Uploaded!#"; ?> What i would like is a 'You are...' to tell my users which place they came. But i don't know how to order my database to tell me that information. Please Help Paul Quote Link to comment https://forums.phpfreaks.com/topic/107971-solved-you-are/ Share on other sites More sharing options...
FlyingIsFun1217 Posted May 30, 2008 Share Posted May 30, 2008 As in what url they are on? FlyingIsFun1217 Quote Link to comment https://forums.phpfreaks.com/topic/107971-solved-you-are/#findComment-553395 Share on other sites More sharing options...
paulman888888 Posted May 30, 2008 Author Share Posted May 30, 2008 as in what place they got in the score list. i have got in my table id - name - score and when the score has been submited i want it to show what place they got (NOT THERE ID). How would i do that? Quote Link to comment https://forums.phpfreaks.com/topic/107971-solved-you-are/#findComment-553397 Share on other sites More sharing options...
GingerRobot Posted May 30, 2008 Share Posted May 30, 2008 $sql = mysql_query("SELECT COUNT(*)+1 as rank FROM example WHERE score > ".mysql_real_escape_string($_GET['score'])) or die(mysql_error()); $rank = mysql_result($sql,0); echo 'Your rank:# '.$rank; Quote Link to comment https://forums.phpfreaks.com/topic/107971-solved-you-are/#findComment-553415 Share on other sites More sharing options...
paulman888888 Posted May 30, 2008 Author Share Posted May 30, 2008 am i adding this to the code or replaceing it? Quote Link to comment https://forums.phpfreaks.com/topic/107971-solved-you-are/#findComment-553429 Share on other sites More sharing options...
GingerRobot Posted May 30, 2008 Share Posted May 30, 2008 What do you think? Take a look at what your current code appears to do and then take a look at what the code i provided appears to do. Quote Link to comment https://forums.phpfreaks.com/topic/107971-solved-you-are/#findComment-553437 Share on other sites More sharing options...
.josh Posted May 30, 2008 Share Posted May 30, 2008 If you are wanting the user's score to be added to the database, then you're adding that code to your code as a separate thing. If you're simply wanting to check the rank against the db, you are changing the code to that. Quote Link to comment https://forums.phpfreaks.com/topic/107971-solved-you-are/#findComment-553438 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.