【发布时间】:2010-05-09 11:26:11
【问题描述】:
我有这样的代码连接到数据库:
$db = new mysqli("localhost", "user", "pass", "company");
现在当我像这样查询数据库时:
//query calls to a stored procedure 'user_info'
$result = $db->query("CALL user_info('$instruc', 'c_register', '$eml', '$pass', '')");
if($result->fetch_array())
{
//use the results
}
$result->close();
$result = $db->query("CALL user_info('$instruc', 's_login', '$eml', '$pass', '')");
if($result->fetch_array())
{
//use the results
}
$result->close();
我在第一个 $result->close(); 之后收到此错误
致命错误:在...中的非对象上调用成员函数 fetch_array()
为了让我运行这个其他查询,我必须关闭数据库连接并再次连接,然后它才能工作。我想知道是否有一种方法可以运行其他查询,而无需断开连接并重新连接到数据库。
【问题讨论】: