Latest web development tutorials

PHP mysqli_info () function

PHP MySQLi Reference Manual PHP MySQLi Reference Manual

Returns information about the most recently executed query:

<?php 
// 假定数据库用户名:root,密码:123456,数据库:w3big 
$con=mysqli_connect("localhost","root","123456","w3big"); 
if (mysqli_connect_errno($con)) 
{ 
    echo "连接 MySQL 失败: " . mysqli_connect_error(); 
} 

// 执行查询
$sql1="CREATE TABLE testwebsites LIKE websites";
mysqli_query($con,$sql1);
$sql2="INSERT INTO testwebsites SELECT * FROM websites ORDER BY alexa LIMIT 3";
mysqli_query($con,$sql2);

// 输出最近查询的信息
echo mysqli_info($con); 

mysqli_close($con);
?>

Definition and Usage

mysqli_info () function returns information about the most recently executed query.

This function is applied to the following types of queries:

  • INSERT INTO ... SELECT ...
  • INSERT INTO ... VALUES (...), (...), (...)
  • LOAD DATA INFILE ...
  • ALTER TABLE ...
  • UPDATE ...

grammar

mysqli_info( connection ) ;

参数 描述
connection 必需。规定要使用的 MySQL 连接。

technical details

return value: It returns a string that contains additional information about the most recently executed query.
PHP version: 5+


PHP MySQLi Reference Manual PHP MySQLi Reference Manual