Current Location: Home> Function Categories> mysql_info

mysql_info

Get the latest query information.
Name:mysql_info
Category:Uncategorized
Programming Language:php
One-line Description:Returns additional information for the last executed SQL statement

Function name: mysql_info()

Applicable version: PHP 5.2.0 and above

Function description: The mysql_info() function returns additional information for the last executed SQL statement.

Syntax: string mysql_info ([ resource $link_identifier = NULL ] )

parameter:

  • link_identifier (optional): MySQL connection identifier. If not provided, the last open connection is used by default.

Return Value: Returns a string containing additional information about the last executed SQL statement.

Example:

 <?php // 创建连接$link = mysql_connect('localhost', 'username', 'password'); // 选择数据库mysql_select_db('database', $link); // 执行SQL查询$result = mysql_query("SELECT * FROM users", $link); // 获取SQL语句的额外信息$info = mysql_info($link); echo "最后一次执行的SQL语句的额外信息:".$info; // 关闭连接mysql_close($link); ?>

Output: Additional information for the last executed SQL statement: Records: 10 Duplicates: 0 Warnings: 0

Notes:

  • This function is only available for PHP versions that use mysql extensions, not for versions that use mysqli or PDO extensions.
  • If the SQL query has not been executed, or the query fails, the function will return an empty string.
  • This function can be used to obtain status information about the query after execution, such as the number of records, the number of duplicates, and the number of warnings.
Similar Functions