I need help on this script, I printed out the student result and try to get their position in class.
<html>
<body>
<table border="0" cellspacing="1" cellpadding="0">
<tr>
<td><p align="center"><strong>Student Name</strong></p></td>
<td><p align="center"><strong>Computer</strong></p></td>
<td><p align="center"><strong>Position</strong></p></td>
</tr>
<tr>
<td><p>Agbo Cynthia </p></td>
<td><p>21.0</p></td>
<td><p> </p></td>
</tr>
<tr>
<td><p>Nwoye Ugochukwu </p></td>
<td><p>76.0</p></td>
<td><p></p></td>
</tr>
<tr>
<td><p>Ogburie Kosisochukwu </p></td>
<td><p>28.0</p></td>
<td><p> </p></td>
</tr>
<tr>
<td><p>Okechukwu Onyeka </p></td>
<td><p>38.0</p></td>
<td><p> </p></td>
</tr>
</table>
</body>
</html>
Having try scripts to determine the student position base on their score that have in db, I could not eventually get the right script. I make use of this scripts bellow, but it repeating scores value.
$row['comp'] is the scores from each student from db
<?php
$grades = array(''.$row['comp'].'');
$occurrences = array_count_values($grades);
$grades = array_unique($grades);
foreach($grades as $grade)
{
echo str_repeat($grade .' - '.($i+1).'<br>',$occurrences[$grade]);
$i += $occurrences[$grade];
}
?>
What I want is a script that will give the student in the class their position according to the computer score in db