After executing the mysql stored procedure commands out of sync; You can ' t run the This command now

Source: Internet
Author: User
PHP calls the stored procedure and then executes SQL to prompt commands out of sync; Can ' t run this command now, what is the problem?

Reply content:

PHP calls the stored procedure and then executes SQL to prompt commands out of sync; Can ' t run this command now, what is the problem?

To solve this problem, we need to use Mysqli's Multi_query method


  
   ';$mysqli->autocommit(FALSE);if ($mysqli->multi_query("call test1();")) {    do {        if ($result = $mysqli->store_result()) {            while ($row = $result->fetch_row()) {                printf("%s\n", $row[0]);            }            $result->close();        }    } while ($mysqli->next_result());}$mysqli->commit();echo "
";echo "result2:
";if ($result2 = $mysqli->query("select val from tb1;")) { while ($row = $result2->fetch_row()) {
", $row[0]); } $result2->close();}else{
  • 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.