Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>According to the MySQL C API documentation:</p> <blockquote> <p>MySQL 5.6 also supports the execution of a string containing multiple statements separated by semicolon (“;”) characters. This capability is enabled by special options that are specified either when you connect to the server with mysql_real_connect() or after connecting by calling` mysql_set_server_option().</p> </blockquote> <p>And:</p> <blockquote> <p>CLIENT_MULTI_STATEMENTS enables mysql_query() and mysql_real_query() to execute statement strings containing multiple statements separated by semicolons. This option also enables CLIENT_MULTI_RESULTS implicitly, so a flags argument of CLIENT_MULTI_STATEMENTS to mysql_real_connect() is equivalent to an argument of CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS. That is, CLIENT_MULTI_STATEMENTS is sufficient to enable multiple-statement execution and all multiple-result processing.</p> </blockquote> <p>So, you can supply several statements in a single mysql_query() call, separated by a semicolon, assuming you set up your mysql connection a bit differently, using mysql_real_connect. You need to pass the following flag as the last argument: CLIENT_MULTI_STATEMENTS, whose documentation says:</p> <blockquote> <p>Tell the server that the client may send multiple statements in a single string (separated by “;”). If this flag is not set, multiple-statement execution is disabled. See the note following this table for more information about this flag.</p> </blockquote> <p>See <a href="http://dev.mysql.com/doc/refman/5.6/en/c-api-multiple-queries.html" rel="nofollow">C API Support for Multiple Statement Execution</a> and <a href="http://dev.mysql.com/doc/refman/5.6/en/mysql-real-connect.html" rel="nofollow">22.8.7.53. mysql_real_connect()</a> for mroe details.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload