MySQL--mysqli::multi_query and Mysqli_multi_query

Source: Internet
Author: User

Syntax:

Object: BOOL mysqli::multi_query ( string $query )

Process: bool mysqli_multi_query ( mysqli $link , string $query )

Usage:

< Span class= "Methodparam" >mysqli::multi_query  (  string  $query  )

$dataStr = ' Multiple SQL statements to execute '; $mysqli new mysqli (hostname,username,password,database);   // connect to MySQL database if ($mysqli-connect_errno) {    connect_error,printf$mysqli );     Exit ();} $mysqli->multi_query ($dataStr);

  mysqli_multi_query  (  mysqli  $link  , < Span class= "type" >string  $query  )

$dataStr = ' Multiple SQL statements to execute '; $link Mysqli_connect ("localhost", "My_user", "My_password", "World");   // connect to MySQL database if ($mysqli-connect_errno) {    connect_error,printf$mysqli );     Exit ();} Mysqli_multi_query ($link,$dataStr  );

Attention:

1. $DATASTR statement requires strict:

1), must be a pure SQL statement, cannot have comments

2), with ";" Execute SQL statement for interval, cannot have non ";" Other than the symbols, such as delimiter $$

2, the return value of the Multi_query () method, and the Mysqli property errno, error, info, and so on are only related to the first SQL command, and it is not possible to determine whether the second and subsequent commands are executing with an error. Therefore, when executing the return value of the Multi_query () method is true, it does not mean that subsequent commands do not have errors at execution time. That is, obviously the result of execution and the expected difference, but the return is true, no error

MySQL--mysqli::multi_query and Mysqli_multi_query

Related Article

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.