PHP mysqli_info() 函数
定义和用法
mysqli_info() 函数返回有关最近执行查询的信息。
该函数作用于下列查询类型:
- INSERT INTO...SELECT...
- INSERT INTO...VALUES (...),(...),(...)
- LOAD DATA INFILE ...
- ALTER TABLE ...
- UPDATE ...
语法
mysqli_info(connection);
返回有关最近执行查询的信息:
<?php // 假定数据库用户名:root,密码:123456,数据库:RUNOOB $con=mysqli_connect("localhost","root","123456","RUNOOB"); 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); ?>