MENU
Information Functions
get_charset() returns the default character set as an object. character_set_name() gives the default character set as a string. set_charset($s) changes the default character set.<?php
$link=mysqli_connect("localhost","root","pwd","testDB");
echo mysqli_character_set_name($link)."\n";
print_r(mysqli_get_charset($link));
mysqli_set_charset($link,'utf8');
?>
set_local_infile_default() unsets user defined handler previously set with set_local_infile_handler().
<?php
$db = mysqli_init();
$db->real_connect("localhost","root","pwd","test");
function loadMe($stream, &$buffer, $buflen, &$errmsg){
$buffer = fgets($stream);
echo $buffer;
$buffer = strtoupper(str_replace(",", "\t", $buffer));
return strlen($buffer);
}
$db->set_local_infile_handler("loadMe");
$db->query(
"LOAD DATA LOCAL INFILE 'input.txt' INTO TABLE t1");
$db->set_local_infile_default();
?>
$client_info gives a string of client information.
$client_version gives an integer of client version.
$server_info gives a string describing the server.
$server_version gives an integer describing the server version. $host_info gives a string representing the type of connection used.
$protocol_version gives the version of MySQL protocol used. For the procedural forms for these six variables, you need to prepend mysqli_get_ instead of mysqli_. The procedural form of $protocol_version is mysqli_get_proto_info($l).
<?php
$S=new mysqli("localhost","root","password","testDB");
echo $S->client_info."\n""
echo $s->client_version."\n";
echo $S->server_info."\n";
echo $S->server_version."\n";
echo $S->host_info."\n";
echo $S->protocol_version."\n";
?>
mysqlnd 5.0.11-dev - 20120503 - $Id: 40933630edef551dfaca71298a83fad8d03d62d4 $ 50011 5.6.16-log 50616 localhost via TCP/IP 10