[英]Get info from tables via stored procedure in MySQL?
正如我在标题中所写,我不确定如何通过存储过程从表中获取信息/选择数据,然后在PHP代码中使用它? 需要一些指导! 谢谢!
哦,这很简单,只需执行“ call proc_name”即可。这是一个针对使用不同数据库扩展名的人使用mysql,mysqli和pdo在php中执行mysql存储过程的快速教程:
http://www.joeyrivera.com/2009/using...ysqlmysqlipdo/
在安装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.