首先是创建存储过程:
use news;
create PROCEDURE tk()
BEGIN
选择 * from news;
END
在MYSQL中运行存储过程的方法:
call tk()
接下来在PHP中页面中运行:
<?php
$pdo=new pdo("mysql:host=localhost;dbname=news","root","");
$stmt=$pdo->query('call my()');
$rk=$stmt->fetchAll();
var_dump($rk);
?>