PHP mysql运算循环出来的字段

php mysql运算循环出来的字段...

<?php
function _init_navshkshadowss($arr, $db) {
    /**
     * 板块回复排行总条数
     * Enter description here .
     * ..
     * 
     * @var unknown_type
     */
    $sqlpostssmax = "SELECT * FROM `blg_forum_forum` WHERE `type` = 'forum' AND `status` = '1' AND `fup` != '0' order by posts DESC limit 10";
    $query = $db->query ( $sqlpostssmax );
    while ( $rs = $db->fetch_array ( $query ) ) {
        $numpost = $rs [posts] + $numpost;
    }
    $sqlpost = "SELECT * FROM `blg_forum_forum` WHERE `type` = 'forum' AND `status` = '1' AND `fup` != '0' order by posts DESC limit 10";
    $query = $db->query ( $sqlpost );
    $i = 0;
    while ( $rs = $db->fetch_array ( $query ) ) {
        $i ++;
        $rs ["i"] = $i;
        $rs ["numpost"] = $numpost;
        $u [] = $rs;
    }
    $this->var ['setting'] ['forumn'] = $u;

}
?>

Leave a Reply

(will not be published)