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 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>"; ?> 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
Archived
This topic is now archived and is closed to further replies.