PHP mysqli_kill() Function



Definition and Usage

The mysqli_kill() function accepts a process id as a parameter and prompts the MySQL server to kill the specified thread.

Syntax

mysqli_kill($con, $processid);

Parameters

Sr.No Parameter & Description
1

con(Mandatory)

This is an object representing a connection to MySQL Server.

2

processid(Mandatory)

It is an integer value representing the process id.

Return Values

This function returns the boolean value which is true if the operation was successful and false incase of failure.

PHP Version

This function was first introduced in PHP Version 5 and works works in all the later versions.

Example

Following example demonstrates the usage of the mysqli_kill() function (in procedural style) −


This will produce following result −

Failed.....

Example

In object oriented style the syntax of this function is $con-> kill(); Following is the example of this function in object oriented style $minus;

thread_id;

   $con->kill($id);

   $res = mysqli_query($con, "CREATE TABLE Sample (name VARCHAR(255))");

   if($res){
      print("Successful.....");
   }else{
      print("Failed......");
   }
?>

This will produce following result −

Failed.....

Example


This will produce following result −

Thread terminated successfully......
php_function_reference.htm
Advertisements