PHP mysqli_info() Function

Definition

The mysqli_info() function returns information about the most recently executed query.

Syntax

PHP mysqli_info() Function has the following syntax.

mysqli_info(connection);

Parameter

ParameterIs RequiredDescription
connectionRequired.Specifies the MySQL connection to use

Return

A character string representing additional information about the most recently executed query.

Example 1

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  ww  w  . j  av  a2s.  c o  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);
?>

Example 2


<?php//w  ww  . j av a  2 s. c o  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();
?>




















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions