I have a problem. I am making a ranking system base on the test scores of applicants. Here is the code:
$testScore = "SELECT Overall_Score, First_Name
FROM applicant_details, person, person_details
where person.ID_No like person_details.ID_No and Position_Applied = 'Work137' and Person_Type = 'Applicant' and applicant_details.ID_No like person.ID_No";
$result = mysql_query($testScore);
$rank = 0;
$lastScore = false;
$rows = 0;
while( $row = mysql_fetch_array( $result ) ){
$name = $row['First_Name'];
$overall = $row['Overall_Score'];
$rows++;
if( $lastScore != $overall){
$lastScore = $overall;
$rank = $rows;
}
echo"Name:$name rank:$rank score: $overall </br>";
}
The output of this code is whoever is the first one to be queried is number 1. Example output:
Name:Utaha rank:1 score: 85
Name:Rikka rank:2 score: 90
I want to have an output:
Name: Utaha rank: 2 score: 85
Name: Rikka rank 1 score: 90
joinsyntax and to have the right join conditions between the tables.