这一段代码是我的论坛的一个小功能, 就是读取数据库的一个表,顺着读出来.但是现在的问题是每次都只读出第一个人的数据,我想应该是ARRAY那地方有问题,但是不知道问题在哪里.这段代码是别人写的,不是很规范.
$listnum = $db->result($db->query("SELECT COUNT(*) FROM {$tablepre}court_judge"), 0);
$query = $db->query("SELECT j.*, m.*, u.stars AS groupstars, r.stars AS rankstars FROM {$tablepre}court_judge j " .
"LEFT JOIN {$tablepre}members m ON j.userid=m.uid " .
"LEFT JOIN {$tablepre}usergroups u ON u.groupid=m.groupid " .
"LEFT JOIN {$tablepre}ranks r ON m.posts>=r.postshigher ORDER BY id DESC LIMIT {$startpage},{$pagenum}");
while($loop1 = $db->fetch_array($query)) {
if($loop1['addtime']) {
$loop1['addtime'] = gmdate($dateformat, $loop1['addtime'] + $timeoffset * 3600);
}
$loop1['grade'] = starsnum($loop1['grade']);
if(!in_array($loop1['username'], $loopname)) {
$loop2[] = $loop1;
$loopname[] = $loop1['username'];
}
}