[英]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.