这是 Code Igniter 中 mysqli 驱动程序的一个已知/常见问题。_execute
您可以通过将mysqli_driver.php 中的方法替换为以下内容来克服它:
public function _execute($sql)
{
// Free result from previous query
@mysqli_free_result($this->result_id);
$sql = $this->_prep_query($sql);
// get a result code of query (), can be used for test is the query ok
$retval = @mysqli_multi_query($this->conn_id, $sql);
// get a first resultset
$firstResult = @mysqli_store_result($this->conn_id);
// free other resultsets
while (@mysqli_next_result($this->conn_id)) {
$result = @mysqli_store_result($this->conn_id);
@mysqli_free_result($result);
}
// test is the error occur or not
if (!$firstResult && !@mysqli_errno($this->conn_id)) {
return true;
}
return $firstResult;
}
不想更改系统文件,我更进一步并按照此处的说明操作:https : //github.com/EllisLab/CodeIgniter/wiki/Extending-Database-Drivers 在应用程序/库中创建我自己的 MY_DB_mysqli_driver文件夹,然后将新_execute
方法放入其中以覆盖父类中的原始方法。