本文整理汇总了PHP中mysqli_get_host_info函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_get_host_info函数的具体用法?PHP mysqli_get_host_info怎么用?PHP mysqli_get_host_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqli_get_host_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAttribute
public function getAttribute($attribute, &$source = null, $func = 'PDO::getAttribute', &$last_error = null)
{
if ($source == null) {
$source =& $this->driver_options;
}
switch ($attribute) {
case PDO::ATTR_AUTOCOMMIT:
$result = mysqli_query($this->link, 'SELECT @@AUTOCOMMIT', MYSQLI_USE_RESULT);
if (!$result) {
$this->set_driver_error(null, PDO::ERRMODE_EXCEPTION, $func);
}
$row = mysqli_fetch_row($result);
mysqli_free_result($result);
return intval($row[0]);
break;
case PDO::ATTR_CLIENT_VERSION:
return mysqli_get_client_info();
break;
case PDO::ATTR_CONNECTION_STATUS:
return mysqli_get_host_info($this->link);
break;
case PDO::ATTR_SERVER_INFO:
return mysqli_stat($this->link);
break;
case PDO::ATTR_SERVER_VERSION:
return mysqli_get_server_info($this->link);
break;
default:
return parent::getAttribute($attribute, $source, $func, $last_error);
break;
}
}
示例2: dump_properties
function dump_properties($mysqli)
{
printf("\nClass variables:\n");
$variables = array_keys(get_class_vars(get_class($mysqli)));
sort($variables);
foreach ($variables as $k => $var) {
printf("%s = '%s'\n", $var, var_export(@$mysqli->{$var}, true));
}
printf("\nObject variables:\n");
$variables = array_keys(get_object_vars($mysqli));
foreach ($variables as $k => $var) {
printf("%s = '%s'\n", $var, var_export(@$mysqli->{$var}, true));
}
printf("\nMagic, magic properties:\n");
assert(@mysqli_affected_rows($mysqli) === @$mysqli->affected_rows);
printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n", @$mysqli->affected_rows, gettype(@$mysqli->affected_rows), @mysqli_affected_rows($mysqli), gettype(@mysqli_affected_rows($mysqli)));
assert(@mysqli_get_client_info() === @$mysqli->client_info);
printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n", @$mysqli->client_info, gettype(@$mysqli->client_info), @mysqli_get_client_info(), gettype(@mysqli_get_client_info()));
assert(@mysqli_get_client_version() === @$mysqli->client_version);
printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n", @$mysqli->client_version, gettype(@$mysqli->client_version), @mysqli_get_client_version(), gettype(@mysqli_get_client_version()));
assert(@mysqli_errno($mysqli) === @$mysqli->errno);
printf("mysqli->errno = '%s'/%s ('%s'/%s)\n", @$mysqli->errno, gettype(@$mysqli->errno), @mysqli_errno($mysqli), gettype(@mysqli_errno($mysqli)));
assert(@mysqli_error($mysqli) === @$mysqli->error);
printf("mysqli->error = '%s'/%s ('%s'/%s)\n", @$mysqli->error, gettype(@$mysqli->error), @mysqli_error($mysqli), gettype(@mysqli_error($mysqli)));
assert(@mysqli_field_count($mysqli) === @$mysqli->field_count);
printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n", @$mysqli->field_count, gettype(@$mysqli->field_count), @mysqli_field_count($mysqli), gettype(@mysqli_field_count($mysqli)));
assert(@mysqli_insert_id($mysqli) === @$mysqli->insert_id);
printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n", @$mysqli->insert_id, gettype(@$mysqli->insert_id), @mysqli_insert_id($mysqli), gettype(@mysqli_insert_id($mysqli)));
assert(@mysqli_sqlstate($mysqli) === @$mysqli->sqlstate);
printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n", @$mysqli->sqlstate, gettype(@$mysqli->sqlstate), @mysqli_sqlstate($mysqli), gettype(@mysqli_sqlstate($mysqli)));
assert(@mysqli_get_host_info($mysqli) === @$mysqli->host_info);
printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n", @$mysqli->host_info, gettype(@$mysqli->host_info), @mysqli_get_host_info($mysqli), gettype(@mysqli_get_host_info($mysqli)));
/* note that the data types are different */
assert(@mysqli_info($mysqli) == @$mysqli->info);
printf("mysqli->info = '%s'/%s ('%s'/%s)\n", @$mysqli->info, gettype(@$mysqli->info), @mysqli_info($mysqli), gettype(@mysqli_info($mysqli)));
assert(@mysqli_thread_id($mysqli) > @$mysqli->thread_id);
assert(gettype(@$mysqli->thread_id) == gettype(@mysqli_thread_id($mysqli)));
printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n", @$mysqli->thread_id, gettype(@$mysqli->thread_id), @mysqli_thread_id($mysqli), gettype(@mysqli_thread_id($mysqli)));
assert(@mysqli_get_proto_info($mysqli) === @$mysqli->protocol_version);
printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n", @$mysqli->protocol_version, gettype(@$mysqli->protocol_version), @mysqli_get_proto_info($mysqli), gettype(@mysqli_get_proto_info($mysqli)));
assert(@mysqli_get_server_info($mysqli) === @$mysqli->server_info);
printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n", @$mysqli->server_info, gettype(@$mysqli->server_info), @mysqli_get_server_info($mysqli), gettype(@mysqli_get_server_info($mysqli)));
assert(@mysqli_get_server_version($mysqli) === @$mysqli->server_version);
printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n", @$mysqli->server_version, gettype(@$mysqli->server_version), @mysqli_get_server_version($mysqli), gettype(@mysqli_get_server_version($mysqli)));
assert(@mysqli_warning_count($mysqli) === @$mysqli->warning_count);
printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n", @$mysqli->warning_count, gettype(@$mysqli->warning_count), @mysqli_warning_count($mysqli), gettype(@mysqli_warning_count($mysqli)));
printf("\nAccess to undefined properties:\n");
printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
@($mysqli->unknown = 13);
printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
$unknown = 'friday';
@($mysqli->unknown = $unknown);
printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
assert(@mysqli_connect_error() === @$mysqli->connect_error);
printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n", @$mysqli->connect_error, gettype(@$mysqli->connect_error), @mysqli_connect_error(), gettype(@mysqli_connect_error()));
assert(@mysqli_connect_errno() === @$mysqli->connect_errno);
printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n", @$mysqli->connect_errno, gettype(@$mysqli->connect_errno), @mysqli_connect_errno(), gettype(@mysqli_connect_errno()));
}
示例3: get_host
/**
* get_host()
*
* returns database host
*/
function get_host()
{
if ($this->dbh) {
return mysqli_get_host_info($this->dbh);
} else {
return "Error: Not connected to a database.";
}
}
示例4: get_details
function get_details()
{
$result = $this->_owner->query('SHOW VARIABLES', false, true);
while ($row = $result->fetch_row()) {
$details[$row[0]] = $row[1];
}
$result->free();
$details['engine'] = 'MySQLi';
$details['client'] = mysqli_get_client_info();
$details['server'] = $this->_owner->connect_id->server_info;
$details['unicode'] = version_compare($details['server'], '4.1') >= 0;
$details['host'] = mysqli_get_host_info($this->_owner->connect_id);
return $details;
}
示例5: bddConnect
function bddConnect()
{
$host = 'db576985956.db.1and1.com';
$user = 'dbo576985956';
$pw = 'raziel63';
$dbname = 'db576985956';
$link = mysqli_connect($host, $user, $pw, $dbname);
if (mysqli_connect_error()) {
die('Erreur de connexion (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
}
echo 'Seko... ' . mysqli_get_host_info($link) . "\n";
return $link;
exit;
}
示例6: Conn
static function Conn()
{
include '../config/includes/config.php';
//conexão nova usando mysqli
//versão nova
$conn = new mysqli($hostname, $usuario, $senha, $db);
if (!$conn) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
echo "Successo: A conexao SQL funcionou! A conexao ao banco de dados está bom. <br>";
echo "Host information: " . mysqli_get_host_info($conn) . "<br>";
//definir transações em utf8
$conn->set_charset('utf8');
return $conn;
//mysqli_close($link);
}
示例7: mysqli_connect
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Saludo</title>
</head>
<body>
<?php
echo 'Primera linea <br />';
echo 'Segunda Linea <br />';
$conexion = mysqli_connect('localhost', 'konectia', 'konectia', 'konectia', 3306);
if (!$conexion) {
echo "Error: No se pudo conectar a MySQL." . PHP_EOL;
echo "errno de depuración: " . mysqli_connect_errno() . PHP_EOL;
echo "error de depuración: " . mysqli_connect_error() . PHP_EOL;
exit;
}
echo "Éxito: Se realizó una conexión apropiada a MySQL! La base de datos 'konectia' es genial." . PHP_EOL;
echo "Información del host: " . mysqli_get_host_info($conexion) . PHP_EOL;
$resultado = $conexion->query("SELECT * FROM clientes");
echo mysqli_affected_rows($resultado);
mysqli_close($conexion);
?>
</body>
</html>
示例8: printf
<?php
require_once "connect.inc";
if (!is_null($tmp = @mysqli_get_host_info())) {
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
if (!is_null($tmp = @mysqli_get_host_info(NULL))) {
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
require "table.inc";
if (!is_string($info = mysqli_get_host_info($link)) || '' === $info) {
printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
}
if ($IS_MYSQLND && $host != 'localhost' && $host != '127.0.0.1' && $port != '' && $host != "" && strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
/* this should be a TCP/IP connection and not a Unix Socket (or SHM or Named Pipe) */
if (!stristr($info, "TCP/IP")) {
printf("[004] Should be a TCP/IP connection but mysqlnd says '%s'\n", $info);
}
}
print "done!";
示例9: session_start
<?php
session_start();
require_once '/var/www/vhosts/theexecutivesguild.org/master_includes.php';
$db = mysqli_connect(HOST, USER, PASSWORD, DBASE);
if (!$db) {
echo "<p>Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL . '</p>';
exit;
}
echo "<!--Success: A proper connection to MySQL was made! The database is great." . PHP_EOL;
echo "Host information: " . mysqli_get_host_info($db) . PHP_EOL . '-->';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: EGL Meeting Module <meetings@theexecutivesguild.org>' . "\r\n";
$headers .= 'Bcc: webmaster@artisticdigital.com' . "\r\n";
//mail('arik@artisticdigital.com', 'test cron','test');
//GET MEETINGS
$q = "SELECT * FROM meeting_events WHERE meeting_date > curdate() ORDER BY meeting_date ASC";
$result = $db->query($q);
while ($data = $result->fetch_object()) {
$meetings[] = $data;
}
//GET MEMBERS
$q = "SELECT * FROM members WHERE mActive=1 order by mLName";
$result = $db->query($q);
while ($data = $result->fetch_object()) {
$members[] = $data;
}
foreach ($meetings as $meeting) {
示例10: phpversion
echo "\t</tr>";
echo "\t<tr>";
echo "\t\t<td><b>PHP version: </b></td>";
echo "\t\t<td>" . phpversion() . "</td>";
echo "\t</tr>";
echo "\t<tr>";
echo "\t\t<td><b>PHP connection: </b></td>";
echo "\t\t<td>" . php_sapi_name() . "</td>";
echo "\t</tr>";
echo "\t<tr>";
echo "\t\t<td><b>MySQL version: </b></td>";
echo "\t\t<td>" . mysqli_get_server_info($conn) . "</td>";
echo "\t</tr>";
echo "\t<tr>";
echo "\t\t<td><b>MySQL connection: </b></td>";
echo "\t\t<td>" . mysqli_get_host_info($conn) . "</td>";
echo "\t</tr>";
echo "\t<tr>";
echo "\t\t<td><b>Current memory usage: </b></td>";
echo "\t\t<td>" . memory_get_usage() . " bytes</td>";
echo "\t</tr>";
echo "\t<tr>";
echo "\t\t<td><b>Peak memory usage: </b></td>";
echo "\t\t<td>" . memory_get_peak_usage(True) . " bytes</td>";
echo "\t</tr>";
echo "</table>";
?>
</div>
<div id="table">
<?php
$query = "\tshow tables";
示例11: PMA_DBI_get_host_info
/**
* Returns a string representing the type of connection used
* @uses mysqli_get_host_info()
* @uses $GLOBALS['userlink'] as default for $link
* @param resource $link mysql link
* @return string type of connection used
*/
function PMA_DBI_get_host_info($link = null)
{
if (null === $link) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return false;
}
}
return mysqli_get_host_info($link);
}
示例12: ini_set
<?php
ini_set('auto_detect_line_endings', TRUE);
//make script safe after use by killing b4 it starts
die("script stopped to avoid unsafe execution");
$file = 'nhifp12.txt';
$handle = fopen($file, 'r');
// print_r($handle);
$dblink = mysqli_connect('localhost', 'root', 'r00t', 'nhif');
if (!$dblink) {
die('Could not connect ' . mysqli_connect_errno() . ': ' . mysqli_connect_error());
}
echo "<br> Successful connection to " . mysqli_get_host_info($dblink);
//print_r($handle);
// $q = mysqli_query($dblink, "select all from routes");
// var_dump($q);
die(" <br> dead script");
$size = 1024;
while (!feof($handle)) {
while (($buffer = fgets($handle, $size)) !== false) {
$buffer;
$data = explode(",", $buffer);
//prepare insert statement
// print_r($data);
$query = "INSERT INTO servicepoints (nhifservicepoint, accreditedfacilityname, county) VALUES (?, ?, ?)";
$stmt = mysqli_prepare($dblink, $query);
// var_dump($query);
// var_dump($stmt);
// die("");
// siss = string, interger, string, string, the types of data to save in db
mysqli_stmt_bind_param($stmt, 'sss', $val1, $val2, $val3);
示例13: mysql_server
public function mysql_server($num = '')
{
switch ($num) {
case 1:
return mysqli_get_server_info();
//MySQL 服务器信息
break;
case 2:
return mysqli_get_host_info();
//取得 MySQL 主机信息
break;
case 3:
return mysqli_get_client_info();
//取得 MySQL 客户端信息
break;
case 4:
return mysqli_get_proto_info();
//取得 MySQL 协议信息
break;
default:
return mysqli_get_client_info();
//默认取得mysql版本信息
}
}
示例14: mysqli_connect
<?php
$host = "localhost";
$user = "root";
$pass = "pensilpensil";
$db = "mysql";
$link = mysqli_connect($host, $user, $pass, $db);
/* check connection */
if (!$link) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit;
}
printf("Host information: %s\n", mysqli_get_host_info($link));
/* close connection */
mysqli_close($link);
?>
示例15: getServerInfo
public function getServerInfo($type = null)
{
if ($this->conn_id && $this->state == self::OPEN) {
switch ($type) {
case self::CLIENT_VERSION:
return mysqli_get_client_info();
break;
case self::HOST_INFO:
return mysqli_get_host_info($this->conn_id);
break;
case self::PROTOCOL_VERSION:
return mysqli_get_proto_info($this->conn_id);
break;
case self::SERVER_VERSION:
default:
return mysqli_get_server_info($this->conn_id);
break;
}
return '';
}
//throw new PhPBURN_Exception() TODO CREATE EXCETION CLASS AND INPUT AN EXCEPTION HERE;
}