php调用存储过程返回结果集,解决can't return a result set in the given context错误的方法
来源:互联网 发布:adobe indesign mac 编辑:程序博客网 时间:2024/06/01 01:34
需要php调用存储过程,返回一个结果集,发现很困难,找了半天,终于在老外的论坛上找到解决方案,这里本地化一下。 关键就是两点 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()); <?php $link = mysql_connect("127.0.0.1", "root", "",1,CLIENT_MULTI_RESULTS) or die("Could not connect: ".mysql_error()); <?php } <?php
下面就可以正常使用了,以下是例子程序。
define('CLIENT_MULTI_RESULTS', 131072);
mysql_select_db("vs") or die("Could not select database");
?>
$result = mysql_query("call get_news_from_class_id(2)") or die("Query failed:" .mysql_error());
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$line = '<tr><td><a target = _blankhref=/''.$row["url"].'/'>'.$row["title"].'('.$row["page_time"].')'.'</a></td></t
r>';
echo $line;
printf("/n");
mysql_free_result($result);
?>
mysql_close($link);
?>
- php调用存储过程返回结果集,解决can't return a result set in the given context错误的方法
- php调用存储过程返回结果集,解决can't return a result set in the given context错误的方法
- php调用存储过程返回结果集,解决can't return a result set in the given context错误的方法
- php调用存储过程返回结果集,解决can't return a result set in the given context错误的方法
- php调用存储过程返回结果集,解决can't return a result set in the given context错误的方法
- php调用存储过程返回结果集,解决can't return a result set in the gi...
- PHP调用存储过程失败(没有执行到)--mysql_error()--can't return a result set in the given context
- PROCEDURE can't return a result set in the given context
- PROCEDURE can't return a result set in the given context
- [转]PHP使用empty检查函数返回结果时报Fatal error: Can't use function return value in write context的问题
- PHP使用empty检查函数返回结果时报Fatal error: Can't use function return value in write context的问题
- PHP使用empty检查函数返回结果时报Fatal error: Can't use function return value in write context的问题
- PHP使用empty检查函数返回结果时报Fatal error: Can't use function return value in write context的问题
- 【转载】PHP使用empty检查函数返回结果时报Fatal error: Can't use function return value in write context的问题
- PHP使用empty检查函数返回结果时报Fatal error: Can't use function return value in write context的问题
- PHP错误Can't use method return value in write context
- PHP 错误 Can’t use function return value in write context
- php调用存储过程返回结果集
- SVN的安装以及配置
- 《BREW进阶与精通——3G移动增值业务的运营、定制与开发》连载之36---支持BREW的手机
- Spring.NET学习笔记(5)-对象生命周期和创建者对象
- Spring.NET学习笔记(6)-基础AOP
- 基于数据挖掘的IDS介绍
- php调用存储过程返回结果集,解决can't return a result set in the given context错误的方法
- 一章雪起的故事
- svn配置中,FSFS与BDB的区别
- 代码1:第二章内置命令示例所用的网页布局文件
- std::string BSTR 互相转化
- 针对TCP协议的攻击与检测、预防方法
- 试论贝叶斯分类、决策树分类分类挖掘算法的优势与劣势,以及解决维度效应的策略
- 代码2:Hello Viewer示例源代码
- MathType--公式使用不再烦恼