怎么写mysql存储过程,并用php调用它
1个回答
展开全部
mysql创建的存储,在mysql里执行就可以
create procedure pr_user_get(
p_user_id int -- 传入的参数
)
proc_start:begin
select b.*
from table1 as a,table2 as b
where a.userid = p_user_id
and a.username = b.username;
end proc_start
php调用
$sql = "call pr_user_get('$userid')";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$row 就是了
create procedure pr_user_get(
p_user_id int -- 传入的参数
)
proc_start:begin
select b.*
from table1 as a,table2 as b
where a.userid = p_user_id
and a.username = b.username;
end proc_start
php调用
$sql = "call pr_user_get('$userid')";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$row 就是了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询