php存储过程输入参数

发布时间:2021-08-03 22:12:08 阅读:1191次

 example:

<?php
// create procedure withparam(in id int) select username from userinfo where userinfo.id=id

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 withparam(@id)",$cxn); 
if($row=mysql_fetch_row($res)){
echo $row[0];
}
else{
echo "sorry~";
}
?>

如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术

支付宝 微信

有疑问联系站长,请联系QQ:QQ咨询

转载请注明:php存储过程输入参数 出自老鄢博客 | 欢迎分享