php调用存储过程返回结果集的例子
php调用存储过程返回结果集,解决can't return a result set in the given context错误的方法。
需要php调用存储过程,返回一个结果集。
关键就是mysql_connect,第四个参数加上1,131072
例子,php调用存储过程返回结果集。
<?php
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 = '<tr><td><a target = _blank href=\''.$row["url"].'\'>'.$row["title"].'('.$row["page_time"].')'.'</a></td></tr>';
echo $line;
printf("\n");
}
mysql_free_result($result);
mysql_close($link);
?>
您可能感兴趣的文章:
php调用存储过程返回结果集的例子
php得到mssql的存储过程的输出参数的代码
php存储过程调用举例
php与mssql存储过程的返回值的相关问题
php获取mssql的存储过程的输出参数的方法
mysql存储过程实例教程
asp.net调用存储过程详解
php mysqli类的演示例子
Sql Server获取存储过程返回值的综合例子
使用 .NET的IO(4) Paul_Ni(原作)