php调用mysql存储过程返回结果集
2010-10-07 05:15
756 查看
关键就是两点
1 define(‘CLIENT_MULTI_RESULTS‘, 131072);
2
3 $link = mysql_connect(“127.0.0.1“, “root“, “”,1,CLIENT_MULTI_RESULTS) or die(“Could not connect: “.mysql_error());
下面就可以正常使用了,以下是例子程序。
1 2 define(‘CLIENT_MULTI_RESULTS‘, 131072);
3
4 $link = mysql_connect(“127.0.0.1“, “root“, “”,1,CLIENT_MULTI_RESULTS) or die(“Could not connect: “.mysql_error());
5 mysql_select_db(“vs“) or die(“Could not select database“);
6 ?>
7
8 9 $result = mysql_query(“call get_news_from_class_id(2)“) or die(“Query failed:“ .mysql_error());
10 while($row = mysql_fetch_array($result, MYSQL_ASSOC))
11 {
12 $line = ‘‘.$row["title"].‘(‘.$row["page_time"].‘)‘.‘ ‘;
14 echo $line;
15 printf(“/n“);
16
17 }
18 mysql_free_result($result);
19 ?>
20
21 22 mysql_close($link);
23 ?>
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"].’)’.’ ’;
echo $line;
printf(“/n”);
}
mysql_free_result($result);
?>
mysql_close($link);
?>
1 define(‘CLIENT_MULTI_RESULTS‘, 131072);
2
3 $link = mysql_connect(“127.0.0.1“, “root“, “”,1,CLIENT_MULTI_RESULTS) or die(“Could not connect: “.mysql_error());
下面就可以正常使用了,以下是例子程序。
1 2 define(‘CLIENT_MULTI_RESULTS‘, 131072);
3
4 $link = mysql_connect(“127.0.0.1“, “root“, “”,1,CLIENT_MULTI_RESULTS) or die(“Could not connect: “.mysql_error());
5 mysql_select_db(“vs“) or die(“Could not select database“);
6 ?>
7
8 9 $result = mysql_query(“call get_news_from_class_id(2)“) or die(“Query failed:“ .mysql_error());
10 while($row = mysql_fetch_array($result, MYSQL_ASSOC))
11 {
12 $line = ‘
14 echo $line;
15 printf(“/n“);
16
17 }
18 mysql_free_result($result);
19 ?>
20
21 22 mysql_close($link);
23 ?>
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 = ‘
echo $line;
printf(“/n”);
}
mysql_free_result($result);
?>
mysql_close($link);
?>
相关文章推荐
- php调用mysql存储过程返回结果集的处理
- php调用mysql存储过程返回结果集的处理
- PHP调用MySQL存储过程并返回值的方法
- mysql调用存储过程无法返回结果集的问题
- MySQL 存储过程调用 返回结果集 实现分页
- php PDO调用多个结果集的mysql存储过程
- PHP调用MySQL存储过程并返回值的方法
- PHP调用MYSQL存储过程方法
- php调用mysql存储过程和函数的方法
- OCCI调用带有返回结果集的存储过程,获取结果集中指定列的值
- php调用mysql存储过程实例分析
- php调用mysql存储过程返回多个结果集的处理
- Mysql存储过程——多结果集返回与java获取
- PHP调用MYSQL存储过程实例
- php调用mysql存储过程和函数的方法
- ThinkPHP调用存储过程不能返回结果集的解决方案
- 快逸报表调用oralce的存储过程(查询临时表,有返回结果集)
- PHP调用MYSQL存储过程实例
- PHP调用MYSQL存储过程实例
- PHP调用MYSQL存储过程实例