Get information about the most recently executed query in PHP
Description
The following code shows how to get information about the most recently executed query.
Example
//www .ja v a 2 s .c o m
<?php
$con=mysqli_connect("localhost","root","","test");
// Check connection
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Perform queries
$sql1="CREATE TABLE testPersons LIKE employee";
mysqli_query($con,$sql1);
$sql2="INSERT INTO testPersons SELECT * FROM employee";
mysqli_query($con,$sql2);
// Print info about most recently executed query
echo mysqli_info($con);
mysqli_close($con);
?>
The code above generates the following result.