Get the MySQL server hostname and connection type in PHP
Description
The following code shows how to get the MySQL server hostname and connection type.
Example
/*from www . ja va2s . c om*/
<?php
$con=mysqli_connect("localhost","root","","test");
// Check connection
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
echo mysqli_get_host_info($con);
mysqli_close($con);
?>
The code above generates the following result.