I have My Sql Database Table as below
idno Name Subject Score
1 Mahesh English 55
1 Mahesh Maths 25
1 Mahesh Science 35
2 Richards English 65
2
2
3
3
3
.................. Like ways so on till id number 12000
Now i will provide a form for the user and tell them to enter id number and submit then the output should be.
If User Enters idno : 3 and submit the form then the output should be
IDNO NAME TOTAL SCORE RANK
1 MAHESH 95 2546 (Example)
and here i am using this code
$id = mysql_real_escape_string($_POST['id']);
$sum = "SELECT idno, SUM(score) AS tech
FROM jbit
WHERE htno='$id'";
$result1 = mysql_query($sum);
echo "
<center><table id='mytable' cellspacing='0' border=3 align=center>
<tr>
<TH scope='col'>IDNO</TH>
<TH scope='col'>NAME</TH>
<TH scope='col'>TOTAL SCORE</TH>
<TH scope='col'>RANK</TH>
</tr><center>";
while ($row = mysql_fetch_assoc($result1)){
echo "<tr>";
echo "<td align=center>" . $row['idno']. "</td>";
echo "<td align=center>" . $row['name']. "</td>";
echo "<td align=center>" . $row['tech']. "</td>";
echo "</tr>";
Here I am unable to calculate the rank and print the rank, how can I do this?
Based on Total Score i.e. SUM(Score) as Tech Rank shold be calculated & Printed
tag of the page
– Suriyamoorthy Baskaran Oct 09 '12 at 13:00