Home  >  Article  >  Backend Development  >  php-[PHP] wamp环境下。使用PDO连接mysql,能执行查询的sql,不能调用存储过程

php-[PHP] wamp环境下。使用PDO连接mysql,能执行查询的sql,不能调用存储过程

WBOY
WBOYOriginal
2016-06-02 11:32:201101browse

phpsql存储过程

$sql='CREATE PROCEDURE t7() select * from tb_article ';
$dbh=new PDO($dsn, 'lms', '123456');
$stmt=$dbh->query('CALL t1()');

<code> // $stmt=$dbh->prepare('CALL t1()');//   $stmt->execute();if($stmt){    $rs=$stmt->fetchAll();}else{    echo '没有查询结果';}</code>
<code></code>

使用query和execute方法都不行,返回结果是false。
存储过程在PHPmyadmin上能正常执行。我在phpmyadmin上执行call t1()能正常执行。图片说明

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn