PHP mysql_stat() function
Definition and Usage
The mysql_stat() function returns the current system status of the MySQL server.
If successful, the function returns the status. If failed, it returns false.
Syntax
mysql_stat(connection)
Parameter | Description |
---|---|
connection | Optional. Specifies the MySQL connection. If not specified, it uses the previous connection. |
Tips and comments
Comment:mysql_stat() currently returns only uptime, threads, queries, open tables, flush tables, and queries per second. To get a complete list of other status variables, you must use the SQL command SHOW STATUS.
Example
<?php $con = mysql_connect("localhost", "hello", "321"); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db("test_db", $con); echo mysql_stat(); ?>
Output similar to:
Uptime: 99410 Threads: 1 Questions: 162 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 0 Queries per second avg: 0.002