PHP mysqli_get_host_info() function returns a string representing the type of connection used including the MySQL server hostname.
Syntax
string mysqli_get_host_info(connection);
Parameter | Description |
---|---|
Connection : | Required parameter. The MySQL connection to be used. |
Return Values : | Returns a character string representing the server hostname and the connection type. |
<?php $con = mysqli_get_charset("localhost","user","password","db"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // Get host information echo mysqli_get_host_info($con); ?>