(PHP 4 >= 4.0.5, PHP 5)
mysql_get_host_info — Get MySQL host info
Questa estensione è stata deprecata in PHP 5.5.0 ed è stata rimossa in PHP 7.0.0. Al suo posto, si dovrebbe usare l'estensione MySQLi o PDO_MySQL. Vedere anche la guida MySQL: scelta dell'API. Le alternative a questa funzione includono:
attribute as PDO::ATTR_CONNECTION_STATUS
Describes the type of connection in use for the connection, including the server host name.
link_identifierLa connessione MySQL. Se
l'identificativo di connessione non è specificato, viene usata l'ultima connessione aperta da
mysql_connect(). Se tale connessione non viene trovata, si
cercherà di crearne una come se mysql_connect() fosse stata chiamata
senza argomenti. Se nessuna connessione viene trovata o stabilita, viene generato un
errore di livello E_WARNING.
Returns a string describing the type of MySQL connection in use for the
connection o false in caso di fallimento.
Example #1 mysql_get_host_info() example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
printf("MySQL host info: %s\n", mysql_get_host_info());
?>Il precedente esempio visualizzerà qualcosa di simile a:
MySQL host info: Localhost via UNIX socket