不知道你用的是什么模板驱动,但是你在读取记录的循环外使用$row当然不行,因为此时$row已为空

解决方案 »

  1.   

    我搞定了。
    谢谢大哥们指点。
    $res =& $db->query($sql); 
         
    $data = array(); 
        while ($res->fetchInto($row)) { 
            $data[] = array( 
                'id' => (int)$row[0], 
                'name' => htmlspecialchars($row[1]), 
                'mail' => htmlspecialchars($row[2]), 
                'tel' => htmlspecialchars($row[3]),
    'dizhi' => htmlspecialchars($row[4]),
    ); 
        } 
         
        $ttt->assign('data', $data);
      

  2.   

    刚遇到一个分页的问题,请大哥门,给我看看,
    $pg = (int) $_GET['pg'];
        if ( $pg < 1 ) {
            $pg = 1;
        }
        $offset = 10;
        $total = 133;
        $param = 'id=5&fid=10';
        $param2 = 'name=cnzxh&[email protected]';
        
        $text = array(
           'first' => 'Start',
           'prev' => 'Prev',
           'next' => 'Next',
           'last' => 'End',
        );
        
        $ttt->assign('pg', $pg);
        $ttt->assign('name', 'pg');
        $ttt->assign('total', $total);
        $ttt->assign('param', $param);
        $ttt->assign('param2', $param2);
        $ttt->assign('offset', $offset);
        
        $ttt->assign('text', $text);
    --------------------------------------------------------------
    这个分页,我看的不是很懂,这个$pg不知道代表着什么。
    还有$offset = 10;
        $total = 133;
        $param = 'id=5&fid=10';
        这里。
    能否给小弟我,具体讲一下。