The mysqli_info() function returns information about the most recently executed query.
PHP mysqli_info() Function has the following syntax.
mysqli_info(connection);
Parameter | Is Required | Description |
---|---|---|
connection | Required. | Specifies the MySQL connection to use |
A character string representing additional information about the most recently executed query.
The following code finds out the information about the most recently executed query.
It returns a string containing information about the most recently executed query.
<?php/*from w w w . j av a 2 s . co m*/
$con=mysqli_connect("localhost","my_user","my_password","my_db");
if (mysqli_connect_errno($con)){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql1="CREATE TABLE NewTable LIKE emp";
mysqli_query($con,$sql1);
echo mysqli_info($con);
mysqli_close($con);
?>
<?php//from www . j a v a 2s . co m
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$mysqli->query("CREATE TEMPORARY TABLE t1 LIKE emp");
/* INSERT INTO .. SELECT */
$mysqli->query("INSERT INTO t1 SELECT * FROM emp");
print $mysqli->info;
$mysqli->close();
?>