note 93494 modified in mysqli.get-connection-stats by danbrown

From: Date: Sun, 13 Sep 2009 15:55:53 +0000
Subject: note 93494 modified in mysqli.get-connection-stats by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160505@lists.php.net to get a copy of this message
While this function is only available if you're using the PHP MySQL Native Driver, you can get the same statistics without this function by using the MySQL SHOW STATUS Query. Use 'SHOW SESSION STATUS;' for statistics about the current MySQL session. Use 'SHOW GLOBAL STATUS;' for totals since the server was started. After you have established a connection with the MySQL Server: <?php $result = $mysqli->query('SHOW SESSION STATUS;', MYSQLI_USE_RESULT); while ($row = $result->fetch_assoc()) { $array[$row['Variable_name']] = $row['Value']; } $result->close(); print_r($array); ?> --was-- While this function is only available if you're using the PHP MySQL Native Driver, you can get the same statistics without this function by using the MySQL SHOW STATUS Query. Use 'SHOW SESSION STATUS;' for statistics about the current MySQL session. Use 'SHOW GLOBAL STATUS;' for totals since the server was started. After you have established a connection with the MySQL Server: $result = $mysqli->query('SHOW SESSION STATUS;', MYSQLI_USE_RESULT); while ($row = $result->fetch_assoc()) { $array[$row['Variable_name']] = $row['Value']; } $result->close(); print_r($array); http://php.net/manual/en/mysqli.get-connection-stats.php

« previous php.notes (#160505) next »