![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
我现在能在mysql的客户端里创建一个存储过程,也能通过php中的mysql_query()函数创建简单的存储过程,
如
在客户端中:
delimiter // ;
create procedure checkuser()
begin
select * from user;
end//
delimiter ;
但是在php中使用函数只能这么写:
mysql_query("create procedure checkuser() select * from user;");
而不能在php中使用函数创建复杂的存储过程,如:
mysql_query("
delimiter // ;
create procedure checkuser(userid int)
begin
declare s_id int;
declare ischeck int;
declare r_num char;
set s_id=userid;
if s_id > 0 then
set r_num = (select room.roomnum from room,stb where stb.roomnum=room.id and stb.id=s_id);
set ischeck = (select id from customerlive where roomnum=r_num);
if ischeck > 0 then
set @a = 1;
else
set @a = 0;
end if;
else
set @a = 0;
end if;
end//
delimiter ;");
我向各位高手请教:怎么才能在php程序中利用函数来创建复杂的存储过程!

