Get stats about the client connection in PHP

Description

The following code shows how to get stats about the client connection.

Example


  //from w ww.  j av 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();
     }
   
     print_r(mysqli_get_connection_stats($con));
    
     mysqli_close($con);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    MySQL »




MySQLi
MySQLi Object Oriented