Name

mysql_get_host_info

Synopsis

string mysql_get_host_info([cresource connection])

Returns a string that describes a MySQL server connection. The string contains the type of connection (TCP or Unix socket) and the hostname. An optional connection resource handle may be provided as the parameter; otherwise, the most recently opened connection that is still open is assumed. This function is available only in PHP 4.0.5 or later versions.

Example

<?php
  mysql_connect("localhost", "root", "drum");
  
  // Prints: This is a Localhost via UNIX socket connection to MySQL.   
  echo "This is a " . mysql_get_host_info(  ) . " connection to MySQL.";
?>

Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.