本文整理汇总了PHP中mysqli_info函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_info函数的具体用法?PHP mysqli_info怎么用?PHP mysqli_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqli_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_last_query_info
/**
*/
function get_last_query_info()
{
if (!$this->db_connect_id) {
return false;
}
// Example: Records: 42 Deleted: 0 Skipped: 0 Warnings: 0
return mysqli_info($this->db_connect_id);
}
示例2: explode
$notify = '<div class="notify_deleted">Query contains a forbidden command.</div>';
break;
}
}
if ($continue !== false) {
$queries = explode(">>BREAK<<", $code);
foreach ($queries as $query) {
if (!mysqli_query($GLOBALS["___mysqli_ston"], "" . $query . "")) {
$error = mysqli_error($GLOBALS["___mysqli_ston"]);
$notify = '<div class="notify_deleted">Execution failed:<br />' . $error . '</div>';
} else {
if ($rows = mysqli_num_rows(mysqli_query($GLOBALS["___mysqli_ston"], "" . $query . ""))) {
$error = mysqli_info($GLOBALS["___mysqli_ston"]);
$notify = '<div class="notify_success">Query succesfully executed.<br />' . $error . '<br />Rows: ' . number_format($rows) . '</div>';
} else {
$error = mysqli_info($GLOBALS["___mysqli_ston"]);
$notify = '<div class="notify_success">Query succesfully executed.<br />' . $error . '</div>';
}
}
}
}
}
?>
<!-- codemirror -->
<link type="text/css" rel="stylesheet" href="/source/Vendor/codemirror/lib/codemirror.css">
<script type="text/javascript" src="/source/Vendor/codemirror/lib/codemirror.js"></script>
<script type="text/javascript" src="/source/Vendor/codemirror/addon/placeholder.js"></script>
<script type="text/javascript" src="/source/Vendor/codemirror/mode/sql/sql.js"></script>
<div class="entries">
示例3: 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()));
}
示例4: mysqli_info_array
function mysqli_info_array($dblink)
{
# Getting our mysqli info
$info = mysqli_info($dblink);
# No results found
if (!$info) {
return false;
}
# Matching our numbers and strings
preg_match_all('!\\d+!', $info, $matches);
preg_match_all('/ (.*?):/', $info, $match);
array_unshift($match[1], explode(':', $info, 2)[0]);
# Creating our info array
$results = [];
for ($i = 0, $len = count($match[1]); $i < $len; $i++) {
$results[$match[1][$i]] = $matches[0][$i];
}
# Returning the results
return $results;
}
示例5: mysqli_insert_array
function mysqli_insert_array($table, $data, $exclude = array())
{
$con = mysqli_connect("localhost", "root", "", "test");
$fields = $values = array();
if (!is_array($exclude)) {
$exclude = array($exclude);
}
foreach (array_keys($data) as $key) {
if (!in_array($key, $exclude)) {
$fields[] = "`{$key}`";
$values[] = "'" . mysql_real_escape_string($data[$key]) . "'";
}
}
$fields = implode(",", $fields);
$values = implode(",", $values);
if (mysqli_query($con, "INSERT INTO `{$table}` ({$fields}) VALUES ({$values})")) {
return array("mysql_error" => false, "mysql_insert_id" => mysqli_insert_id($con), "mysql_affected_rows" => mysqli_affected_rows($con), "mysql_info" => mysqli_info($con));
} else {
return array("mysql_error" => mysqli_error($con));
}
}
示例6: mysqli_connect
$password = "p";
$dbname = "dbname";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
set_time_limit(0);
// Sets the Time Limit to Unlimited - saves you from Maximum execution time of 30 seconds exceeded ERROR of PHP
// Get all the tables in your database
$sql = "select TABLE_NAME from information_schema.tables where table_schema = 'DBNAME-IMPORTANT'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$sql = "UPDATE " . $row["TABLE_NAME"] . " SET Date = STR_TO_DATE(`Date`, '%d/%m/%Y')";
if (mysqli_query($conn, $sql)) {
echo mysqli_info($conn) . " ---> Table Name > " . $row["TABLE_NAME"] . "<br/>";
// if(true) exit; // Uncomment this line if you wanna test the Output with one table
} else {
echo '<span style="color: red;">Error Occured -- ' . mysqli_error($conn) . '</span> ---> Table Name > ' . $row["TABLE_NAME"] . '<br/>';
// if(true) exit; // Uncomment this line if you wanna test the Output with one table
}
}
} else {
echo "0 results";
}
mysqli_close($conn);
?>
示例7: my_mysqli_connect
<?php
require_once "connect.inc";
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_query($link, "DROP TABLE IF EXISTS test_032_table_1");
mysqli_query($link, "CREATE TABLE test_032_table_1 (a INT)");
mysqli_query($link, "INSERT INTO test_032_table_1 VALUES (1),(2),(3)");
$afc = mysqli_info($link);
var_dump($afc);
mysqli_query($link, "DROP TABLE IF EXISTS test_032_table_1");
mysqli_close($link);
print "done!";
error_reporting(0);
require_once "connect.inc";
if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) {
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
}
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_032_table_1")) {
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
mysqli_close($link);
示例8: status
public function status()
{
if (is_array($this->_connection)) {
$this->connect();
}
$rs = mysqli_info($this->_connection);
$rs0 = $this->_query("show variables like '%char%'");
while (null !== ($r = mysqli_fetch_row($rs0))) {
$rs[$r[0]] = $r[1];
}
return $rs;
}
示例9: info
function info()
{
if ($this->LinkID) {
return mysqli_info($this->LinkID);
}
}
示例10: mysqlInfo
public function mysqlInfo()
{
return mysqli_info($this->conn);
}
示例11: serendipity_db_matched_rows
/**
* Returns the number of matched rows in a SQL query
*
* @access public
* @return int Number of matched rows
*/
function serendipity_db_matched_rows()
{
global $serendipity;
preg_match("/^[^0-9]+([0-9]+)[^0-9]+([0-9]+)[^0-9]+([0-9]+)/", mysqli_info($serendipity['dbConn']), $arr);
// mysqli_affected_rows returns 0 if rows were matched but not changed.
// mysqli_info returns rows matched
return $arr[0];
}
示例12: get_info
public function get_info()
{
$this->output->info("Getting info");
return mysqli_info($this->con);
}
示例13: assert
assert(mysqli_error_list($link) === $mysqli->error_list);
assert(is_array($mysqli->error_list));
}
assert(mysqli_field_count($link) === $mysqli->field_count);
printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n", $mysqli->field_count, gettype($mysqli->field_count), mysqli_field_count($link), gettype(mysqli_field_count($link)));
assert(mysqli_insert_id($link) === $mysqli->insert_id);
printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n", $mysqli->insert_id, gettype($mysqli->insert_id), mysqli_insert_id($link), gettype(mysqli_insert_id($link)));
assert(mysqli_sqlstate($link) === $mysqli->sqlstate);
printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n", $mysqli->sqlstate, gettype($mysqli->sqlstate), mysqli_sqlstate($link), gettype(mysqli_sqlstate($link)));
assert(soundex(mysqli_stat($link)) == soundex($mysqli->stat));
printf("mysqli->stat = '%s'/%s ('%s'/%s)\n", $mysqli->stat, gettype($mysqli->stat), mysqli_stat($link), gettype(mysqli_stat($link)));
assert(mysqli_get_host_info($link) === $mysqli->host_info);
printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n", $mysqli->host_info, gettype($mysqli->host_info), mysqli_get_host_info($link), gettype(mysqli_get_host_info($link)));
/* note that the data types are different */
assert(mysqli_info($link) == $mysqli->info);
printf("mysqli->info = '%s'/%s ('%s'/%s)\n", $mysqli->info, gettype($mysqli->info), mysqli_info($link), gettype(mysqli_info($link)));
assert(mysqli_thread_id($link) > $mysqli->thread_id);
assert(gettype($mysqli->thread_id) == gettype(mysqli_thread_id($link)));
printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n", $mysqli->thread_id, gettype($mysqli->thread_id), mysqli_thread_id($link), gettype(mysqli_thread_id($link)));
assert(mysqli_get_proto_info($link) === $mysqli->protocol_version);
printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n", $mysqli->protocol_version, gettype($mysqli->protocol_version), mysqli_get_proto_info($link), gettype(mysqli_get_proto_info($link)));
assert(mysqli_get_server_info($link) === $mysqli->server_info);
printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n", $mysqli->server_info, gettype($mysqli->server_info), mysqli_get_server_info($link), gettype(mysqli_get_server_info($link)));
assert(mysqli_get_server_version($link) === $mysqli->server_version);
printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n", $mysqli->server_version, gettype($mysqli->server_version), mysqli_get_server_version($link), gettype(mysqli_get_server_version($link)));
assert(mysqli_warning_count($link) === $mysqli->warning_count);
printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n", $mysqli->warning_count, gettype($mysqli->warning_count), mysqli_warning_count($link), gettype(mysqli_warning_count($link)));
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);
示例14: run_sql
/**
* Run a SQL query
*
* @param string $sql
* @param string $file
* @param string $line
* @author Mauri Kujala <contact@edtb.xyz>
*/
function run_sql($sql, $file, $line)
{
//write_log("Running query: " . $sql, $file, $line);
$this->link->query($sql) or write_log(mysqli_error($this->link), $file, $line);
$info = mysqli_info($this->link);
write_log($info, $file, $line);
}
示例15: query
/**
*
* @param string $sanitizedQueryText
* @return boolean|mysqli_result // FALSE (on failure), mysqli_result (for select,show,describe,explain), or TRUE (for other queries)
*/
public function query($sanitizedQueryText)
{
$wo = WOOOF::$instance;
$this->affectedRows = null;
$result = mysqli_query($this->connection, $sanitizedQueryText);
$this->affectedRows = mysqli_affected_rows($this->connection);
if ($this->error() != '') {
$debugInfo = debug_backtrace();
$lastLevel = count($debugInfo) - 1;
//$wo->log(WOOOF_loggingLevels::WOOOF_CRITICAL_ERROR,
// "Query Failed ! at ". $debugInfo[$lastLevel]['file'] ." on line ". $debugInfo[$lastLevel]['line'] ." Query text: \n\n$sanitizedQueryText\n\nMysql Error:". $this->error());
$wo->log(WOOOF_loggingLevels::WOOOF_CRITICAL_ERROR, self::_ECP . "0030 Mysql Error: " . $this->error());
if ($wo->getConfigurationFor('displayDatabaseErrors') && !$wo->isAjax) {
echo '<br><span style="font-size:14px;color:red;background-color:yellow;">' . nl2br("Query Failed ! at " . $debugInfo[0]['file'] . " on line " . $debugInfo[0]['line'] . "</font> Query text: \n\n{$sanitizedQueryText}\n\nMysql Error:" . $this->error() . "\n" . '</span><br>');
}
return FALSE;
}
$this->lastQueryInfo = mysqli_info($this->connection);
if (!$this->lastQueryInfo && $result !== TRUE) {
if (@mysqli_num_rows($result)) {
$this->lastQueryInfo = "Returned Rows: " . mysqli_affected_rows($this->connection);
} elseif (mysqli_affected_rows($this->connection)) {
$this->lastQueryInfo = "Affected Rows: " . mysqli_affected_rows($this->connection);
}
}
$displaySqlLevel = $wo->getConfigurationFor('displaySQLStatementsLevel');
if (!($displaySqlLevel == 0 || $displaySqlLevel == 1 && strpos($sanitizedQueryText, '__') !== FALSE)) {
echo $sanitizedQueryText . PHP_EOL . '<br/>';
}
//always call logging, better safe than sorry
$this->logQuery($sanitizedQueryText);
return $result;
}