Forum Moderators: coopster
The question is put up in 1.php the answer to be compared is in 2.php and the next level is 3.php
what is the sql query to create a field for this?
how will 2.php handle this to update the leaderboard?thanku in advance..
after each level
//count all scores equal to or less than score.
$query="SELECT * FROM tablename WHERE score <= $score";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
//start at end and move each position up by 1
for($i = $num_rows; $i >= $position; $i--)
{
$position = $i + 1;
$query= "Update tablename SET position ='$position' WHERE player_name ='$player_name' AND position = '$i'";
$temp = mysql_query($query)
or die(mysql_error());
}
//pu your code below to insert new record