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
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
procedure can't return a result set in the given context的更多相关文章
- MySQL Error: PROCEDURE xmdk.query_all_plan can't return a result set in the given context
C++调用存储过程失败!出现如下错误:MySQL Error: PROCEDURE xmdk.query_all_plan can't return a result set in the given ...
- Mysql5.7创建存储过程中调用自定义函数报错Not allowed to return a result set from a function
因为很多存储过程都会共用一段sql语句,所以我把共用的sql封装成一个自定义函数 AddCapital(); 然后通过存储过程调用,创建存储过程会报错1415,Not allowed to retur ...
- asp.net mvc return file result
asp.net mvc返回文件: public ActionResult ExportReflection(string accessToken) { var reflections = GetCms ...
- Using Stored Programs with MySQLdb
http://flylib.com/books/en/1.142.1.125/1/ Using Stored Programs with MySQLdb The techniques for call ...
- python 调用mysql存储过程返回结果集
存储过程: delimiter | ),)) begin select * from tb_test where mid = imid and user = iuser; end; | delimit ...
- Mysql存储过程知识,案例--mysql存储过程基本函数
Mysql存储过程知识,案例: create procedure delete_setting(in p_settingid integer) begin delete from setting wh ...
- 2017最新PHP面试题
这几天在面试,下面分享一下这几天面试所遇到的笔试题,目前还不打算工作,面试题会持续更新的,有些不想写答案了,有心的可以自己看着面试题查一下感觉记忆更深点.下面分享一下这几天遇到的php面试题. 掌贝面 ...
- mysql中的prepare介绍和应用
简单的用set或者declare语句定义变量,然后直接作为sql的表名是不行的,mysql会把变量名当作表名.在其他的sql数据库中也是如此,mssql的解决方法是将整条sql语句作为变量,其中穿插变 ...
- SQL语法基础之高级应用
SQL语法基础之高级应用 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.存储过程与函数 1>.CREATE PROCEDURE 用来创建存储过程 mysql> ? ...
随机推荐
- Stream,Reader/Writer,Buffered的区别(2)
Reader: Reader的子类: 1.BufferedReader: FileReader 没有提供读取文本行的功能,BufferedReader能够指定缓冲区大小,包装了read方法高效读取字符 ...
- linux下搭建mysql主从
在master上创建repl账户,用于复制. grant replication slave on *.* to 'repl'@'%' identified by 'P@$$W0rd'; flush ...
- xml之Schema架构
1.什么是Schema架构 2.Schema文档结构 3.Schema元素类型 1>element元素 <!--简单数据:类型--> <xs:element name=&qu ...
- 设计模式之Birdge(桥接)模式
1.出现原因 1.同一个类型,有两个变化的维度(两个维度的抽象:一个抽象部分的抽象,一个实现部分的抽象) 2.如何应对这种“多维度的变化”?如何利用面向对象技术来使得同一类型可以轻松地沿着两个方向变化 ...
- Kibana4学习<二>
生产环境部署 Kibana4 是是一个完整的 web 应用.使用时,你需要做的只是打开浏览器,然后输入你运行 Kibana 的机器地址然后加上端口号.比如说:localhost:5601 或者 htt ...
- 【吐血推荐】简要分析unity3d中剪不断理还乱的yield
在学习unity3d的时候很容易看到下面这个例子: void Start () { StartCoroutine(Destroy()); } IEnumerator Destroy(){ yield ...
- C#打印页面的纸张设置问题Spread表格控件
这段时间学习spread控件,用到打印设置上边,其他的设置都还好说,但是打印纸张的大小,纸张类型等把我折腾的够呛,找了半天才找到,记录下来备查. 1.打印纸张类型: System.Drawing.Pr ...
- Retry Pattern
Retry Pattern https://msdn.microsoft.com/en-us/library/dn589788.aspx https://msdn.microsoft.com/en-u ...
- VS2012配置Lua环境
1.VS2012配置BabeLua插件 2.VS2012配置Lua 1.VS2012配置BabeLua插件 BabeLua插件简介: 安装方法: 关闭VS2012后直接安装BabeLua插件. 下载地 ...
- JS 学习笔记--6---日期和时间
在日期和时间这一块的学习中发现,其实和其他大部分的高级语言中时间和日期的操作差不多,没什么特别的,但是要注意的就是 ECMAScript中规定的一些方法在各大浏览器中的实现方式是不一样的,也就是说存在 ...