PHP mysqli_get_connection_stats() Function
In this chapter you will learn:
- Definition for PHP mysqli_get_connection_stats() Function
- Syntax for PHP mysqli_get_connection_stats() Function
- Parameter for PHP mysqli_get_connection_stats() Function
- Return for PHP mysqli_get_connection_stats() Function
- Example - gets stats about the client connection
Definition
The mysqli_get_connection_stats() function returns statistics about the client connection.
Syntax
Object oriented style
bool mysqli::get_connection_stats ( void )
Procedural style
array mysqli_get_connection_stats ( mysqli $link )
Parameter
Parameter | Is Required | Description |
---|---|---|
connection | Required. | MySQL connection |
Return
Returns an array with connection stats if success, FALSE otherwise.
Example
The following code gets stats about the client connection.
<?php//jav a 2 s . 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();
}
print_r(mysqli_get_connection_stats($con));
mysqli_close($con);
$link = mysqli_connect();
print_r(mysqli_get_connection_stats($link));
?>
Next chapter...
What you will learn in the next chapter:
- Definition for PHP mysqli_get_host_info() Function
- Syntax for PHP mysqli_get_host_info() Function
- Parameter for PHP mysqli_get_host_info() Function
- Return for PHP mysqli_get_host_info() Function
- Example - Gets the MySQL server hostname and connection type
- Example - Object orient version
Home » PHP Tutorial » PHP MySQLi Functions