paulman888888 Posted May 30, 2008 Share Posted May 30, 2008 Does anyone know how i could get this code to tell you where you came? Eg after score has been submited it will tell you what place you came? <?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!#"; ?> Thankyou Quote Link to comment https://forums.phpfreaks.com/topic/107975-solved-how-can-i-make-this-show/ Share on other sites More sharing options...
MadTechie Posted May 30, 2008 Share Posted May 30, 2008 heres a quick write up, untested but should work, <?php 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.#'); mysql_query("SELECT count(name) as position FROM example WHERE score > ".mysql_real_escape_string($_GET['score'])) or die('Theres an error. Please try again.#'); $row = mysql_fetch_assoc($result); $position = $row['position']+1; echo "your Position was ".$row['position']."<br>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/107975-solved-how-can-i-make-this-show/#findComment-553492 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.