codeigniter:命令不同步;您现在不能运行此命令 [英] codeigniter : Commands out of sync; you can't run this command now

查看:54
本文介绍了codeigniter:命令不同步;您现在不能运行此命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应用了所有可能的答案,但仍然是同样的问题。
也尝试过

I applied all the possible answers but still same problem. also tried

$this->db->reconnect();

我的查询没有问题

MyCode:

public function GetdistributorsDetails($username){
        $sql = "SELECT u.FirstName, u.Email, u.Telephone, u.MobileNumber, u.AlternateMobileNumber, ud.Address1, ud.Pincode,ud.City,s.Statename FROM users u JOIN userdetails ud ON ud.UserId = u.UserId JOIN states s ON s.StateId = ud.StateId WHERE u.Username = ? ";
        $result = $this->db->query($sql,array($username));
        return $result->result_array();
    }


推荐答案

将以下代码添加到/ system中/database/drivers/mysqli/mysqli_result.php

add following code into /system/database/drivers/mysqli/mysqli_result.php

 function next_result()
 {
     if (is_object($this->conn_id))
     {
         return mysqli_next_result($this->conn_id);
     }
 }

然后在模型中调用存储过程

then in model when you call Stored Procedure

$query    = $this->db->query("CALL test()");
$res      = $query->result();

//add this two line 
$query->next_result(); 
$query->free_result(); 
//end of new code

return $res;

这篇关于codeigniter:命令不同步;您现在不能运行此命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆