PHP – MySQL Processes Information

The given PHP example helps you to get the info of all mysql processes.

Code Example:
<?php
$server = "localhost";
$username = "root";
$password = "";
 
$conn =  mysql_connect($server, $username, $password) or die("Couldn't connect to MySQL" . mysql_error());
$processes = mysql_list_processes();
echo "<table>";
echo "<tr><th>ID</th><th>User</th><th>Host</th><th>DB</th>
  <th>Command</th><th>Time</th><th>State</th><th>Info</th>
  </tr>";

while ($row = mysql_fetch_row($processes)) {
  list($id,$user,$host,$db,$command,$time,$state,$info) = $row;
  echo "<tr><td>$id</td><td>$user</td>
	 <td>$host</td><td>$db</td><td>$command</td>
	 <td>$time</td><td>$state</td><td>$info</td>
	 </tr>";
}
echo "</table>";
mysql_close($conn);
?>

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail

Leave a Comment

Your email address will not be published. Required fields are marked *