因此,我一直使用带有codeigniter的mysql驱动程序,但现在我需要执行存储过程,因此需要Mysqli驱动程序。因为显然mysql驱动程序不支持存储过程。现在我可以执行存储过程了,但是本机会话管理器被破坏了。它不能在Ci_session表中存储会话。给出以下错误
错误号: 2014
命令不同步;您现在不能运行此命令
更新ci_sessions设置last_activity = 1369672449,user_data =user_data,其中session_id = '1b29074ae286b900b02e410916d93f26‘
文件名: F:\xampp\htdocs\project\system\database\DB_driver.php
行号: 330
帮助!
发布于 2013-05-28 03:37:10
这是Code Igniter中mysqli驱动程序的一个已知/常见问题。您可以通过将mysqli_driver.php中的_execute方法替换为以下代码来克服此问题:
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在应用程序/库文件夹中创建我自己的应用程序,然后将新的_execute方法放入其中以覆盖父类中的原始方法。
https://stackoverflow.com/questions/16777265
复制相似问题