downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

mysql_get_proto_info> <mysql_get_client_info
[edit] Last updated: Fri, 25 May 2012

view this page in

mysql_get_host_info

(PHP 4 >= 4.0.5, PHP 5)

mysql_get_host_infoMySQL ホスト情報を取得する

説明

string mysql_get_host_info ([ resource $link_identifier = NULL ] )

使用されている接続の型を返します。その中にはサーバーのホスト名も含まれます。

パラメータ

link_identifier

MySQL 接続。 指定されない場合、mysql_connect() により直近にオープンされたリンクが 指定されたと仮定されます。そのようなリンクがない場合、引数を指定せずに mysql_connect() がコールした時と同様にリンクを確立します。 リンクが見付からない、または、確立できない場合、 E_WARNING レベルのエラーが生成されます。

返り値

使用されている MySQL 接続の型を表す文字列を返します。 失敗した場合に FALSE を返します。

例1 mysql_get_host_info() の例

<?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());
?>

上の例の出力は、 たとえば以下のようになります。

MySQL host info: Localhost via UNIX socket

参考



add a note add a note User Contributed Notes mysql_get_host_info
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites