php Code:$r = $db->sql_query('SELECT `qid`, `title`, `hit_count` FROM `' . $prefix . '_nquiz_quiz` ORDER BY rand() LIMIT 0,1');
list($qid, $title, $main_total) = $db->sql_fetchrow($r);
$statistics = $db->sql_query('SELECT * FROM `' . $prefix . '_nquiz_scoreboard` WHERE `qid` = \'' . $qid . '\' ORDER BY `perc` DESC LIMIT 0, ' . $pagenum . '');
OpenTable();
echo '<div class="t-center thick">' , _NQ_TOP , ' ' , $pagenum , ' ' , _NQ_LISTSCORE , ' ' , _NQ_CPLAYERSBY , ' : ' , $main_total , ' ' , _NQ_PLAYERS , '<br /> ' , htmlspecialchars($title, ENT_QUOTES, _CHARSET) , '</div><br />' , PHP_EOL
, '<table width="98%" border="1" class="centered" cellpadding="2" cellspacing="2">' , PHP_EOL
, '<tr>' , PHP_EOL
, '<th width="5%">#</th>' , PHP_EOL
, '<th width="30%">' , _NQ_UNAME , '</th>' , PHP_EOL
, '<th width="10%">' , _NQ_PERCENT , '</th>' , PHP_EOL
, '<th width="20%">' , _NQ_TTAKEN , '</th>' , PHP_EOL
, '<th width="35%">' , _NQ_DATETAKEN , '</th>' , PHP_EOL
, '</tr>' , PHP_EOL;
if ($db->sql_numrows($statistics) == '') {
echo '<td colspan="6"> </td>' , PHP_EOL
, '</tr>' , PHP_EOL
, '<tr>' , PHP_EOL
, '<td class="text-center thick" colspan="6"> ' , _NQ_NORESULTS , '</td>' , PHP_EOL
, '</tr>' , PHP_EOL;
} else {
$rowcount = $min+1;
while ($astatistics = $db->sql_fetchrow($statistics)) {
$setid = $db->sql_fetchrow($db->sql_query('SELECT * FROM `' . $prefix . '_nquiz_quiz` WHERE `qid` = \'' . $qid . '\''));
$user = $astatistics['username'];
$name_len = $nq_config['cutoff'];
if (strlen($user) > $name_len){
$user = substr($user, 0, ($name_len-2)) . '...';
}
$score = $astatistics['score'];
$perc = $astatistics['perc'];
$date = $astatistics['date'];
$date = date($dateformat,$date );
$ttime = $astatistics['ttime'];
echo '<tr>' , PHP_EOL
, '<td class="row1" class="text-center">' , $rowcount , '</td>' , PHP_EOL
, '<td class="row1" class="text-left">' , htmlspecialchars($user, ENT_QUOTES, _CHARSET) , '</td>' , PHP_EOL
, '<td class="row1" class="text-center"> ' , $perc , ' %</td>' , PHP_EOL
, '<td class="row1" class="text-center">' , $ttime , '</td>' , PHP_EOL
, '<td class="row1" class="text-center">' , $date , '</td>' , PHP_EOL
, '</tr>' , PHP_EOL;
$rowcount++;
} # end of while
}
echo '</table><br />' , PHP_EOL;
|