The mysqli_get_connection_stats() function returns statistics about the client connection.
Object oriented style
bool mysqli::get_connection_stats ( void )
Procedural style
array mysqli_get_connection_stats ( mysqli $link )
Parameter | Is Required | Description |
---|---|---|
connection | Required. | MySQL connection |
Returns an array with connection stats if success, FALSE otherwise.
The following code gets stats about the client connection.
<?php//from w ww . j av a2 s .c om
$con=mysqli_connect("localhost","my_user","my_password","my_db");
if (mysqli_connect_errno($con)){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
print_r(mysqli_get_connection_stats($con));
mysqli_close($con);
$link = mysqli_connect();
print_r(mysqli_get_connection_stats($link));
?>