[英]How to call mysql store procedure in php?
I have created stored procedures in mysql and now i want to use them in php script. 我已经在mysql中创建了存储过程,现在我想在php脚本中使用它们。
For using stored procedure through php, i am using this code: 对于通过php使用存储过程,我正在使用以下代码:
$query = "call authenticateUser('$username')";
$result = mysql_query($query) or die(mysql_error());
But this is showing error of command is not sync. 但这表明命令错误不同步。
Pls someone tell me how to call stored procedure in php. 请有人告诉我如何在php中调用存储过程。
$username = mysql_real_escape_string($username);
$query = "CALL authenticateUser('" . $username . "')";
$result = mysql_query($query) or die(mysql_error());
You can use statement like this: 您可以使用如下语句:
$query = "call authenticateUser($username)"; $ query =“致电authenticateUser($ username)”;
with double quote there is no need of separation. 双引号不需要分隔。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.