本文整理汇总了PHP中DupUtil::mysqli_connect方法的典型用法代码示例。如果您正苦于以下问题:PHP DupUtil::mysqli_connect方法的具体用法?PHP DupUtil::mysqli_connect怎么用?PHP DupUtil::mysqli_connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DupUtil
的用法示例。
在下文中一共展示了DupUtil::mysqli_connect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strlen
$_baseURL = strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
$_baseURL = "http://" . $_baseURL;
header("HTTP/1.1 301 Moved Permanently");
header("Location: {$_baseURL}");
exit;
}
/* JSON RESPONSE: Most sites have warnings turned off by default, but if they're turned on the warnings
cause errors in the JSON data Here we hide the status so warning level is reset at it at the end*/
$ajax2_error_level = error_reporting();
error_reporting(E_ERROR);
//====================================================================================================
//DATABASE UPDATES
//====================================================================================================
$ajax2_start = DupUtil::get_microtime();
//MYSQL CONNECTION
$dbh = DupUtil::mysqli_connect($_POST['dbhost'], $_POST['dbuser'], html_entity_decode($_POST['dbpass']), $_POST['dbname'], $_POST['dbport']);
$charset_server = @mysqli_character_set_name($dbh);
@mysqli_query($dbh, "SET wait_timeout = {$GLOBALS['DB_MAX_TIME']}");
DupUtil::mysql_set_charset($dbh, $_POST['dbcharset'], $_POST['dbcollate']);
//POST PARAMS
$_POST['blogname'] = mysqli_real_escape_string($dbh, $_POST['blogname']);
$_POST['postguid'] = isset($_POST['postguid']) && $_POST['postguid'] == 1 ? 1 : 0;
$_POST['fullsearch'] = isset($_POST['fullsearch']) && $_POST['fullsearch'] == 1 ? 1 : 0;
$_POST['path_old'] = isset($_POST['path_old']) ? trim($_POST['path_old']) : null;
$_POST['path_new'] = isset($_POST['path_new']) ? trim($_POST['path_new']) : null;
$_POST['siteurl'] = isset($_POST['siteurl']) ? rtrim(trim($_POST['siteurl']), '/') : null;
$_POST['tables'] = isset($_POST['tables']) && is_array($_POST['tables']) ? array_map('stripcslashes', $_POST['tables']) : array();
$_POST['url_old'] = isset($_POST['url_old']) ? trim($_POST['url_old']) : null;
$_POST['url_new'] = isset($_POST['url_new']) ? rtrim(trim($_POST['url_new']), '/') : null;
//LOGGING
$POST_LOG = $_POST;
示例2: while
$dbquery_errs = 0;
$counter = 0;
@mysqli_autocommit($dbh, false);
while ($counter < $sql_result_file_length) {
$query_strlen = strlen(trim($sql_result_file_data[$counter]));
if ($dbvar_maxpacks < $query_strlen) {
DUPX_Log::Info("**ERROR** Query size limit [length={$query_strlen}] [sql=" . substr($sql_result_file_data[$counter], 75) . "...]");
$dbquery_errs++;
} elseif ($query_strlen > 0) {
@mysqli_free_result(@mysqli_query($dbh, $sql_result_file_data[$counter]));
$err = mysqli_error($dbh);
//Check to make sure the connection is alive
if (!empty($err)) {
if (!mysqli_ping($dbh)) {
mysqli_close($dbh);
$dbh = DupUtil::mysqli_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], $_POST['dbname']);
}
DUPX_Log::Info("**ERROR** database error write '{$err}' - [sql=" . substr($sql_result_file_data[$counter], 0, 75) . "...]");
$dbquery_errs++;
//Buffer data to browser to keep connection open
} else {
if ($fcgi_buffer_count++ > $fcgi_buffer_pool) {
$fcgi_buffer_count = 0;
DupUtil::fcgi_flush();
}
$dbquery_rows++;
}
}
$counter++;
}
@mysqli_commit($dbh);