MySQLi - Kill
语法
bool mysqli_kill ( mysqli $link , int $processid )
定义和用法
它要求服务器终止 MySQL 线程。
示例
试试下面的例子 −
<?php $servername = "localhost:3306"; $username = "root"; $password = ""; $dbname = "TUTORIALS"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error()); exit(); } if (!mysqli_query($conn, "SET a = 1")) { printf("Errorcode: %d ", mysqli_error($conn)); } echo 'Success... ' . mysqli_get_host_info($conn) . " "; $thread_id = mysqli_thread_id($conn); mysqli_kill($conn, $thread_id); $sql = "CREATE TABLE tutorials_auto1 LIKE tutorials_auto"; mysqli_query($conn,$sql); $sql1 = "INSERT INTO tutorials_auto1 SELECT * FROM tutorials_auto ORDER BY name LIMIT 2"; mysqli_query($conn,$sql1); printf ("New Record has id %d. ", $conn->insert_id); $conn->close(); ?>
上述代码的示例输出应该是这样的 -
Errorcode: 0 Success... localhost:3306 via TCP/IP New Record has id 0.