Returns the MySQL server hostname and connection type:
<?php$con=mysqli_connect("localhost","my_user","my_password","my_db");//Detect connection if (mysqli_connect_errno($con)) { echo "Database connection failed: " . mysqli_connect_error(); }echo mysqli_get_host_info($con);mysqli_close($con);?>The mysqli_get_host_info() function returns the MySQL server host name and connection type.
mysqli_get_host_info( connection ) ;
parameter | describe |
---|---|
connection | Required. Specifies the MySQL connection to use. |
Return value: | Returns a string representing the MySQL server hostname and connection type. |
---|---|
PHP version: | 5+ |