如何在php脚本中调用存储过程? [英] how to call an stored procedure in php script ?

查看:85
本文介绍了如何在php脚本中调用存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在mysql中创建了一个存储过程..



分隔符

创建过程inserttbl()< br $> b $ b

开始



插入用户名(userName,pass)值('manohar',123); < br $>


结束

分隔符;






现在我想从我的php脚本中使用(执行或调用)这个程序



我怎么称呼这个?



i使用此代码....



mysqli_prepare($ con,call inserttbl() )或死(mysqli_error());



但它不起作用

i have created an stored procedure in mysql ..

delimiter
create procedure inserttbl()

begin

insert into username(userName,pass) values('manohar',123);

end
delimiter ;



now i want to use(execute or call) this procedure from my php script

how can i call this ?

i use this code for this ....

mysqli_prepare($con,"call inserttbl()") or die(mysqli_error());

but it's not working

推荐答案

con,call inserttbl())或die(mysqli_error());



但它不起作用
con,"call inserttbl()") or die(mysqli_error());

but it's not working


你可以看看这个



php-calling-mysql-stored-procedures / [ ^ ]

< a href =http://www.joeyrivera.com/2009/using-mysql-stored-procedures-with-php-mysqlmysqlipdo/> using-mysql-stored-procedures-with-php-mysqlmysqlipdo / [ ^ ]

http://nirodhasoftware.com/site/?p=125 [< a href =http://nirodhasoftware.com/site/?p=125target =_ blanktitle =新窗口> ^ ]
You can have a look at this

php-calling-mysql-stored-procedures/[^]
using-mysql-stored-procedures-with-php-mysqlmysqlipdo/[^]
http://nirodhasoftware.com/site/?p=125[^]


这篇关于如何在php脚本中调用存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆