
下文为您介绍的是PHP调用MYSQL存储过程中调用传入参数的存储过程及传出参数的存储过程这两种情况,该调用方法供您参考,希望对您有所帮助。
传入参数的MYSQL存储过程
$sql = “
create procedure myproce2(in score int)
begin
if score >= 60 then
select ‘pass’;
else
select ‘no’;
end if;
end;
“;
mysql_query($sql);//创建一个myproce2的存储过程
$sql = “call test.myproce2(70);”;
mysql_query($sql);//调用myproce2的存储过程,看不到效果,可以在cmd下看到结果。
传出参数的MYSQL存储过程
$sql = “
create procedure myproce3(out score int)
begin
set score=100;
end;
“;
mysql_query($sql);//创建一个myproce3的存储过程
$sql = “call test.myproce3(@score);”;
mysql_query($sql);//调用myproce3的存储过程
$result = mysql_query(‘select @score;’);
$array = mysql_fetch_array($result);
echo ‘<pre>’;print_r($array);
【编辑推荐】
mysql存储过程的调用方法
MYSQL IFNULL函数的使用
带您了解MySQL GROUP_CONCAT函数
MySQL日期的相关函数介绍
带您深入了解MYSQL Cast函数
文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/230831.html<