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

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

WBOY
Release: 2016-06-02 11:32:20
Original
1142 people have browsed it

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>
Copy after login
<code></code>
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template