PHP mysqli_info() 函数
2018-12-08 16:45 更新
PHP mysqli_info() 函数
实例
返回有关最近执行查询的信息:
<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Perform queries
$sql1="CREATE TABLE testPersons LIKE Persons"
mysqli_query($con,$sql1);
$sql2="INSERT INTO testPersons SELECT * FROM Persons ORDER BY LastName LIMIT 10"
mysqli_query($con,$sql2);
// Print info about most recently executed query
echo mysqli_info($con);
mysqli_close($con);
?>
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Perform queries
$sql1="CREATE TABLE testPersons LIKE Persons"
mysqli_query($con,$sql1);
$sql2="INSERT INTO testPersons SELECT * FROM Persons ORDER BY LastName LIMIT 10"
mysqli_query($con,$sql2);
// Print info about most recently executed query
echo mysqli_info($con);
mysqli_close($con);
?>
定义和用法
mysqli_info() 函数返回有关最近执行查询的信息。
该函数作用于下列查询类型:
- INSERT INTO...SELECT...
- INSERT INTO...VALUES (...),(...),(...)
- LOAD DATA INFILE ...
- ALTER TABLE ...
- UPDATE ...
语法
mysqli_info(connection);
参数 | 描述 |
---|---|
connection | 必需。规定要使用的 MySQL 连接。 |
技术细节
返回值: | 返回一个字符串,包含有关最近执行查询的额外信息。 |
---|---|
PHP 版本: | 5+ |
PHP MySQLi 参考手册
以上内容是否对您有帮助:
更多建议: