Php-[PHP] wamp environment. Use PDO to connect to mysql. the SQL statements that can be queried cannot call the stored procedure.

Source: Internet
Author: User
$ SQL & #39; CREATEPROCEDUREt7 () select * fromtb_article & #39; $ dbhnewPDO ($ dsn, & #39; lms & #39;, & #39; 123456 & #39;); $ stmt $ dbh-& gt; query (& #39; CALLt1 () & #39;); $ stmt $ dbh-& gt; prepare (& #39; CALLt1 () & #39;); $ stmt-& gt; execute (); if ($ stmt) {$ rs $ st phpsql stored procedure

$ SQL = 'create PROCEDURE t7 () select * from tb_article ';
$ Dbh = new PDO ($ dsn, 'LMS ', '123 ');
$ Stmt = $ dbh-> query ('Call t1 ()');

// $ Stmt = $ dbh-> prepare ('Call t1 () '); // $ stmt-> execute (); if ($ stmt) {$ rs = $ stmt-> fetchAll ();} else {echo 'no query result ';}

Neither query nor execute method works. the returned result is false.
The stored procedure can be executed normally in PHPmyadmin. Call t1 () can be executed normally on phpmyadmin.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.