[英]Get info from tables via stored procedure in MySQL?
As I wrote in the title I'm not sure how to get info / select data from tables via a stored procedure and then use it int the PHP code? 正如我在标题中所写,我不确定如何通过存储过程从表中获取信息/选择数据,然后在PHP代码中使用它? Need some guidelines! 需要一些指导! Thanks! 谢谢!
Oh it was simple, just execute "call proc_name" Here's a quick tutorial on executing mysql stored procedures in php using mysql, mysqli, and pdo for the people using the different database extension: 哦,这很简单,只需执行“ call proc_name”即可。这是一个针对使用不同数据库扩展名的人使用mysql,mysqli和pdo在php中执行mysql存储过程的快速教程:
http://www.joeyrivera.com/2009/using...ysqlmysqlipdo/ http://www.joeyrivera.com/2009/using...ysqlmysqlipdo/
Before you installed the php_mysqli.dll 在安装php_mysqli.dll之前
<?php
/* Connect to a MySQL server */
include("connection.php");
/* Send a query to the server */
if ($result = mysqli_query($link, "call se_proc('crm')")) //call PROC_NAME for execute Store Procedured
{
/* Fetch the results of the query */
while( $row = mysqli_fetch_array($result) ){
echo ($row[0]. "--------- SR. " . $row[1] . "<br>");
}
/* Destroy the result set and free the memory used for it */
mysqli_free_result($result);
}
/* Close the connection */
mysqli_close($link);
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.