我尝试从数据库生成排名,但0(零)值始终显示Rank-1。
我的代码
<?php $ra ="
SELECT SUM(TermOneWritten), FIND_IN_SET( TermOneWritten, (
SELECT GROUP_CONCAT(DISTINCT TermOneWritten
ORDER BY TermOneWritten DESC)
FROM std_result WHERE StudentID = '".$studentID."' GROUP BY StudentID)
) AS rank
FROM std_result
WHERE StudentID = '".$studentID."' GROUP BY StudentID";
$res = mysqli_query($mysqli, $ra);
while($r=mysqli_fetch_array($res)){
echo "RANK - " . $r["rank"]. "";
}
?>