php存储过程输入输出参数

 example:

<!--
SHOW CREATE PROCEDURE hi;
create procedure inoutsp(in id int,out str varchar(50))
begin
if id=1 then
set str="1->hello";
else
set str="othernumber->hi";
end if;
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("set @id=$id",$cxn); 
$res=mysql_query("call inoutsp(@id,@str)",$cxn); 
$res=mysql_query("select @str",$cxn); 
$row=mysql_fetch_row($res);
echo $row[0];
?>

    A+
发布日期:2021年08月03日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: