Which interfaces of mysql and mysqli access mysql are selected from php
- 2020-05-30 19:42:12
- OfStack
As we know, mysqli is the new MySQL interface provided in PHP 5, which USES the object-oriented idea. Code that USES the mysqli interface is more readable and executes more efficiently than the mysql interface. And mysqli provides an multi_query() function that can execute multiple SQL statements once. However, the mysqli interface only supports versions after PHP 5 and MySQL 4.1.
The query() function can execute only one SQL statement at a time, while the multi_query() function can execute more than one SQL statement at a time.
If the first SQL statement is executed correctly, the multi_query() function returns true, otherwise false.
Get a record of the query executed by the multi_query() function through the store_result() function. Only one SQL statement can be executed at a time.
The next_result() function determines whether the result of an SQL statement exists, and if so, returns true.
Example:
$sql="select * from score; select * from student";
$rs=$connection->multi_query($sql);