All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
php调用存储过程返回结果集_php资料_编程技术

Writer: aaa Article type: Programming skills(编程技巧) Time: 2013/12/27 19:53:37 Browse times: 305 Comment times: 0

php调用存储过程返回结果集_php资料_编程技术


r>';
echo $line;
printf("\n");

}
mysql_free_result($result);
?>

mysql_close($link);
?>





Head photo

Go homepage
Upload pictures
Write articles

php调用存储过程返回结果集_php资料_编程技术-你的首页-uuhomepage.com

  php调用存储过程返回结果集,解决can't return a result set in the given context错误的方法需要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());

下面就可以正常使用了,以下是例子程序。

define('CLIENT_MULTI_RESULTS', 131072);

$link = mysql_connect("127.0.0.1", "root", "",1,CLIENT_MULTI_RESULTS) or die("Could not connect: ".mysql_error());
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 = '

'.$row["title"].'('.$row["page_time"].')'.'

There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.