2013-05-27 183 views
0

所以我一直在使用mysql驅動程序與codeigniter,但現在我需要執行存儲過程,並且需要Mysqli驅動程序。因爲顯然MySQL驅動程序不支持存儲過程。 現在我可以執行存儲過程但本地會話管理器已損壞。它不能將會話存儲在Ci_session表中。提供了以下錯誤codeigniter mysqli驅動程序壞會話類

錯誤編號:2014

命令不同步;不能運行此命令現在

UPDATE SET ci_sessions = last_activity 1369672449,user_data =「A:2:{S:9:\ 「的user_data \」; S:0:\ 「\」; S:7: \ 「USER_ID \」; S:1:\ 「1 \」;}」 WHERE session_id = '1b29074ae286b900b02e410916d93f26'

文件名:F:\ XAMPP \ htdocs中\項目\ SYSTEM \數據庫\ DB_driver.php

行號:330

幫助!

+0

看起來,在頁面的某個地方,您正在對數據庫執行(最有可能的)'SELECT'查詢,而無需讀取結果。 –

回答

2

這是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 && [email protected]_errno($this->conn_id)) { 
     return true; 
    } 

    return $firstResult; 
} 

不是想改變我已經採取了這一更進一步的系統文件和這裏遵循的指示:https://github.com/EllisLab/CodeIgniter/wiki/Extending-Database-Drivers創造我自己MY_DB_mysqli_driver放入應用程序/庫文件夾中,然後將新的_execute方法放入該文件中以覆蓋父類中的原始文件。

+0

非常感謝!它正在工作。 – Tejas

+0

不客氣,很高興我能提供幫助。 –

相關問題