Right then chaps...
I've made some improvements and it works to a certain extent except that if the first user has the same score then the second user then it displays this....
Postion USer Correct Answers Percentage
1 Simon 6 50%
1== Paul 6 50%
It should read 1== 1==.
The table has to display the top ten entries, however there is a twist in the tale if the 10th user equals the 9th user then its has to select the next ten...so basically we get this effect
Postion USer Correct Answers Percentage
1 Simon 6 50%
1== Paul 6 50%
2 John 5 45%
3==
3==
4
5
6==
6==
7
8==
8==
9==
9==
10==
10==
Code:
$result=mysql_query("select count(*) FROM quiz_questions,quiz_category where quiz_questions.qzid=$qzid AND quiz_questions.catid=quiz_category.catid");
list($quest_count)=mysql_fetch_row($result);
if ($offset=='') $offset=0; $result=mysql_query("select quiz_input.fuid,fname,surname,count(*) from quiz_input,quiz_answer,quiz_questions,users where quiz_input.qsid=quiz_answer.qsid and correct='yes' and quiz_input.qsid=quiz_questions.qsid and quiz_input.qaid=quiz_answer.qaid and quiz_questions.qzid=$qzid and users.fuid=quiz_input.fuid group by fuid order by 2 LIMIT $offset,10");
$counter=1;
$prevScore=-1;
while(list($DBfuid,$DBfname,$DBsurname,$DBcount)=mysql_fetch_row($result))
{
if ($DBcount != $prevScore)
{
$position=$counter;
}
else
{
$position=$counter-1;
$position.='==';
}
echo "$position"
echo "$DBfname" ." "."$DBsurname$DBcount"; $percent=round(($DBcount*100)/($quest_count)); echo "$percent" . "%". ""; $prevScore=$DBcount;
$counter++;
}
Once again your help is appreciated....
Thanks
Osman