PHP mysql_list_processes() function

Definition and Usage

mysql_list_processes() function lists MySQL processes.

If successful, mysql_list_processes() returns a result pointer that describes the current server threads. If it fails, it returns false.

Syntax

mysql_list_processes(connection)
Parameter Description
connection Optional. Specifies the MySQL connection. If not specified, the previous connection is used.

Example

<?php
$con = mysql_connect("localhost", "hello", "321");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
$my_list = mysql_list_processes($con);
while ($row = mysql_fetch_assoc($my_list))
  {
  print_r($row);
  }
mysql_close($con);
?>

Output similar to:

Array
(
[Id] => 2
[User] => hello
[Host] => localhost:1038
[db] =>
[Command] => Processlist
[Time] => 0
[State] =>
[Info] =>
)