求助:function的重复引用

求助:function的重复引用

//下面是自定义函数
function request_teacher($pid){
global $db;
$wherestr = $pid ? " where `pid` = '{$pid}' " : '';
$strhtml = '';
        $query = $db->query("select `ctid`, `cttitle` from `lzu_content` {$wherestr} order by `ctdatetime` DESC");
        while($row=$db->fetch_array($query)){
                $strhtml .= "<li style=\"font-size:12px;\"><a href=\"index.php?id={$row['ctid']}\">{$row['cttitle']}</a></li>";
        }
$strhtml = $strhtml ? $strhtml : 'No Content!';
return $strhtml;
$db->close();
}

//调用:
echo request_teacher(7); //第一次没问题
echo request_teacher(28); //第二次调用便出错,不知什么原因?

妳用Smarty??
我的Blog

提示什么错误啊
毕业了。。。

没有用Smarty,提示错误如下:
Warning: mysql_query(): 6 is not a valid MySQL-Link resource in D:\LZ-TM\include\db.mysql.php on line 44
MySQL Query Error : select `ctid`, `cttitle`,`pid` from `lzu_content` where `pid` = '28'

搞定,谢谢两位,是我多用了一个$db->close();

你这里执行一次是就 $db->close();关闭链接了
你去掉$db->close();试试
如履薄冰