Location: PHPKode > projects > Nukequiz > html/modules/Nukequiz/admin/NQAUpdateLeagueUser.php
<?php
/*****************************************************************/
/* Nukequiz (tm)    v 3.1.0                                		 */
/* By: Kissoftware (hide@address.com)      		     */
/* http://www.kissoftware.org.uk                           		 */
/* http://www.kissoftware.co.uk                       		     */
/* Copyright © 2003-2008 by Kissoftware         				 */
/* See Docs For Information & Credits                 			 */
/* For More information Visit Forums Or The Online Help Manual	 */
/*****************************************************************/
$result = $db->sql_query("SELECT qid FROM ".$prefix."_nquiz_scoreboard WHERE username='$username'");
$r1 = $db->sql_query("SELECT COUNT(*) FROM ".$prefix."_nquiz_scoreboard WHERE username='$username'");
list($count) = $db->sql_fetchrow($r1);
while ($row = $db->sql_fetchrow($result)) {
$qid = $row['qid'];
$resultpoints = $db->sql_query("SELECT points_total, maxqnum FROM ".$prefix."_nquiz_quiz WHERE qid='$qid'");
while ($row = $db->sql_fetchrow($resultpoints)) {
$point = intval($row['points_total']);
$grandtotal=$point+$grandtotal;
$ques = $row['maxqnum'];
$gquestotal=$ques+$gquestotal;
}
}
$resulttotal = $db->sql_query("SELECT sum(score) as totalscore FROM ".$prefix."_nquiz_scoreboard WHERE username='$username'");
list($totalscore) = $db->sql_fetchrow($resulttotal);
$cal = ($totalscore/$grandtotal);
$perc  =  round($cal*100,2);
$average = ($totalscore/$count);
$avg  =  round($average, 0);
$db->sql_query("UPDATE ".$prefix."_nquiz_league SET  count='$count', score = '$totalscore', average = '$avg', total ='$grandtotal', totalques='$gquestotal', perc ='$perc', updated = '1' WHERE username='$username'");
Header("Location: ".$admin_file.".php?op=nqleague");
?>
Return current item: Nukequiz