本文整理汇总了PHP中mysqli_kill函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_kill函数的具体用法?PHP mysqli_kill怎么用?PHP mysqli_kill使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqli_kill函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: close
public function close()
{
foreach (array(self::LINK_TYPE_SLAVE, self::LINK_TYPE_MASTER) as $type) {
if (array_key_exists($type, $this->links) && $this->links[$type] instanceof \mysqli) {
$tid = mysqli_thread_id($this->links[$type]);
if ($tid !== false) {
mysqli_kill($this->links[$type], $tid);
}
mysqli_close($this->links[$type]);
unset($this->links[$type]);
}
}
$this->links = array();
}
示例2: insertInto
public function insertInto($table, $values)
{
if (is_array($values)) {
$str = "INSERT INTO `{$table}` VALUES (NULL,";
foreach ($values as $value) {
$str .= "'" . $value . "',";
}
$str = substr($str, 0, strlen($str) - 1);
$str .= ")";
$nc = $this->c();
$q = mysqli_query($nc, $str);
mysqli_kill($nc, mysqli_thread_id($nc));
mysqli_close($nc);
if ($q) {
return true;
} else {
return false;
}
} else {
return false;
}
}
示例3: printf
}
if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) {
printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
}
if (!mysqli_stmt_execute($stmt)) {
printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
}
$id = NULL;
$label = NULL;
if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) {
printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
}
if (true !== ($tmp = mysqli_stmt_fetch($stmt))) {
printf("[013] Expecting boolean/true, got %s/%s, [%d] %s\n", gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
}
if (!mysqli_kill($link, mysqli_thread_id($link))) {
printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (true !== ($tmp = mysqli_stmt_fetch($stmt))) {
printf("[015] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
}
mysqli_stmt_close($stmt);
if (NULL !== ($tmp = mysqli_stmt_fetch($stmt))) {
printf("[016] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
mysqli_close($link);
/* Check that the function alias exists. It's a deprecated function,
but we have not announce the removal so far, therefore we need to check for it */
if (!is_null($tmp = @mysqli_stmt_fetch())) {
printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
示例4: nl2br
<div id="boxlinks2">
<?php
include 'inc/boxlinks2.php';
?>
</div>
<div id="content2">
<h2><?php
echo nl2br($daten['titel_' . $lang]);
?>
</h2><br />
<?php
echo nl2br($daten[$lang]);
?>
</div><div id="nebennavigation"><div id="nebennavigationinnen"><?php
include 'inc/nebennavigation_' . $lang . '.php';
?>
</div> </div></div>
</div>
</body>
</html>
<?php
$thread_id = mysqli_thread_id($link);
mysqli_kill($link, $thread_id);
mysqli_close($link);
示例5: exit
include "../scripts/db.php";
if (!isset($_SESSION["uid"], $_SESSION["user"])) {
exit("<div class='m_s_g'>Invalid Authentication<div>");
}
$uid = intval($_SESSION["uid"]);
if ($uid != 0 && isset($uid)) {
$con = new db();
$conc = $con->c();
$num = 0;
$subjres = mysqli_query($conc, "SELECT `id` FROM `msg_subj` WHERE `u1` = {$uid} OR `u2` = {$uid}");
if ($subjres) {
while ($sb = mysqli_fetch_array($subjres)) {
$msg = mysqli_query($conc, "SELECT `new`,`uid` FROM `msg` WHERE `new` = 1 AND `cid` = " . $sb[0] . " ORDER BY `id` DESC");
if ($msg) {
$ltv = mysqli_fetch_array($msg);
$numr = mysqli_num_rows($msg);
if ($numr > 0 && $ltv[1] != $uid) {
$num = $num + $numr;
}
}
}
}
$num = $num > 0 ? $num : "";
$subjres = NULL;
$sb = NULL;
echo $num;
$_SESSION["msg_num"] = $num;
}
mysqli_kill($conc, mysqli_thread_id($con->c()));
mysqli_close($con->c());
exit;
示例6: mysqli_query
mysqli_query($link, "FOO");
mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db);
mysqli_kill($link, -1);
// mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it
mysqli_real_query($link, "FOO");
if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name")) {
printf("[009] select_db should have failed\n");
}
// mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it
// Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would
// not have been set. If that would be the case, the test would be broken.
mysqli_report(MYSQLI_REPORT_OFF);
mysqli_multi_query($link, "BAR; FOO;");
mysqli_query($link, "FOO");
mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db);
mysqli_kill($link, -1);
mysqli_real_query($link, "FOO");
mysqli_select_db($link, "Oh lord, let this be an unknown database name");
mysqli_report(MYSQLI_REPORT_OFF);
mysqli_report(MYSQLI_REPORT_STRICT);
try {
if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) {
printf("[010] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", $host, $user . 'unknown_really', $db, $port, $socket);
}
mysqli_close($link);
} catch (mysqli_sql_exception $e) {
printf("[011] %s\n", $e->getMessage());
}
try {
if (!($link = mysqli_init())) {
printf("[012] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
示例7: close_db_con
public function close_db_con($nc)
{
mysqli_kill($nc, mysqli_thread_id($nc));
return mysqli_close($nc);
}
示例8: printf
} else {
if (mysqli_errno($mysqli) > 0) {
printf("[015] %d/%s\n", mysqli_errno($mysqli), mysqli_error($mysqli));
}
}
$processed++;
}
if (microtime(true) - $begin > 5) {
printf("[016] Pulling the emergency break after 5s, something is wrong...\n");
break;
}
} while ($processed < 2);
// Killing connection - 3
$link = get_connection();
$thread_id = mysqli_thread_id($link);
mysqli_kill(get_connection(), $thread_id);
// Sleep 0.1s to ensure the KILL gets recognized
usleep(100000);
if (false !== ($tmp = mysqli_query($link, "SELECT 1 AS 'processed before killed'", MYSQLI_ASYNC | MYSQLI_USE_RESULT))) {
printf("[017] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true));
}
$links = array($link);
$errors = array($link);
$reject = array($link);
if (0 !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 10000))) {
printf("[018] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true));
}
if (!is_array($links) || empty($links)) {
printf("[019] Expecting non-empty array got %s/%s\n", gettype($links), var_export($links, true));
} else {
foreach ($links as $link) {
示例9: Clsoe
public function Clsoe()
{
$thread_id = mysqli_thread_id($this->con);
mysqli_kill($this->con, $thread_id);
}