php调用mysql存储过程输出参数
2011-02-18 15:04
676 查看
<!--
create procedure in_out (in parameter integer)
begin
declare variable varchar(20);
if parameter=1 then
set variable='MySQL';
else
set variable='PHP';
end if;
insert into userinfo(username) values (variable);
end;
-->
<!--
create procedure outstatement(out str varchar(50))
begin
set str="hello the world!";
end ;
-->
<?php
define('CLIENT_MULTI_RESULTS',131072);
$host="localhost";
$user="root";
$password="";
$id=$_REQUEST["id"];
$cxn = mysql_connect($host,$user,$password,1,CLIENT_MULTI_RESULTS) or die("Could not connect: ".mysql_error());
$db=mysql_select_db("test");
$res=mysql_query("call outstatement(@str)",$cxn);
$res=mysql_query("select @str",$cxn);
$row=mysql_fetch_row($res);
echo $row[0];
?>
create procedure in_out (in parameter integer)
begin
declare variable varchar(20);
if parameter=1 then
set variable='MySQL';
else
set variable='PHP';
end if;
insert into userinfo(username) values (variable);
end;
-->
<!--
create procedure outstatement(out str varchar(50))
begin
set str="hello the world!";
end ;
-->
<?php
define('CLIENT_MULTI_RESULTS',131072);
$host="localhost";
$user="root";
$password="";
$id=$_REQUEST["id"];
$cxn = mysql_connect($host,$user,$password,1,CLIENT_MULTI_RESULTS) or die("Could not connect: ".mysql_error());
$db=mysql_select_db("test");
$res=mysql_query("call outstatement(@str)",$cxn);
$res=mysql_query("select @str",$cxn);
$row=mysql_fetch_row($res);
echo $row[0];
?>
相关文章推荐
- MySQL存储过程例子(包含事务,输出参数,嵌套调用)
- MySQL 存储过程带in和out参数以及PHP,PB如何调用的小例子
- MySQL存储过程例子,包含事务,输出参数,嵌套调用,游标,循环等等
- MySQL存储过程例子,包含事务,输出参数,嵌套调用
- MySQL 存储过程带in和out参数以及PHP,PB如何调用的小例子
- 【Mysql 调用存储过程,输出参数的坑】
- MySQL存储过程例子(包含事务,输出参数,嵌套调用)
- SQLSERVER 存储过程调用存储过程,如何得到输出参数
- PHP调用MYSQL存储过程实例
- mybatis调用存储过程的例子,含输入输出参数
- PHP如何得到mssql的存储过程的输出参数?
- PHP调用MsSQL Server 2012存储过程获取多结果集(包含output参数)
- 关于存储过程的ADO调用的一些心得(输出参数,返回值)
- C#调用存储过程带输出参数或返回值分类(转)
- PHP调用MySQL存储过程
- PHP调用MYSQL存储过程实例
- Java调用Oracle集合类型输出参数的存储过程
- 存储过程的输出参数为游标,PL/SQL中如何调用 Java代码如何调用
- C#中调用存储过程:带输入输出参数