procedure can't return a result set in the given context

调用存储过程失败!出现如下错误:PROCEDURE ipbx.qu_ery can't return a result set in the given context,

ipbx是数据库,
qu_ery是自己写的存储过程的名字;

 

原因:连接数据库的方式不正确。

导致报错的连接方式: 

<?php   
if(!mysql_real_connect(&mysql,"localhost","root","123456","ipbx",0,NULL,0))
        {
                printf("mysql_real_connect() failed!/n");
                mysql_close(&mysql);
                return 0;
        }
正确的连接方式:

       
<?php
if(!mysql_real_connect(&mysql,"localhost","root","123456","ipbx",0,NULL,CLIENT_MULTI_STATEMENTS))
         {
                printf("mysql_real_connect() failed!/n");
                mysql_close(&mysql);
                return 0;
        }
修改一下连接数据库的方式的参数就OK了!

FROM: http://blog.csdn.net/huichengongzi/article/details/5571346

 

你修改一下
system/database/drivers/mysql/mysql_driver.php

function db_connect()
    {
    define("CLIENT_MULTI_RESULTS",131072);//Enable/disable multi-results
    define("CLIENT_MULTI_STATEMENTS",65536);//Enable/disable multi-statement support
        
    return @mysql_connect($this->hostname, $this->username, $this->password, TRUE,CLIENT_MULTI_STATEMENTS);
    } 

FROM: http://ellislab.com/forums/viewthread/71141#476251

 

To retrieve multiple resultsets from the stored procs, you should use a client which supports multiple queries.

If you use PHP, use MySQLi extension and call the procedure using mysqli_multi_query.

MySQL extension is only able to retrieve the first recordset returned by the proc. To be able to use ti, you should set CLIENT_MULTI_RESULTS (decimal 131072) in the parameter $client_flags tomysql_connect

FROM: http://stackoverflow.com/questions/5447930/stored-procedure-mysql-fails-with-cant-return-a-result-set-in-the-given-cont#5447952

 

codeigniter 调用存储过程出错 

关键就是两点
  1)define('CLIENT_MULTI_RESULTS', 131072);
  2)$link = mysql_connect("127.0.0.1", "root", "",1,CLIENT_MULTI_RESULTS) or die("Could not connect: ".mysql_error());

FROM: http://codeigniter.org.cn/forums/thread-6129-1-1.html

转载于:https://www.cnblogs.com/blogsme/p/3421206.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值