note 40165 added to function.mysql-query
| From: | GABZinOZ at rn2 dot php dot net | Date: | Mon, 23 Feb 2004 22:44:40 +0000 |
| Subject: | note 40165 added to function.mysql-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65619@lists.php.net to get a copy of this message | ||
a little snippet to get the db size and all tables and all entries back! ENJOY ...
Use functions from users noted under filesize() to convert output into human readable string :))
function get_dbsize($db) {
$query = "SHOW TABLE STATUS FROM ". $db;
if ($result = mysql_query($query)) {
$tables = 0;
$rows = 0;
$size = 0;
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$rows += $row["Rows"];
$size += $row["Data_length"];
$size += $row["Index_length"];
$tables++;
}
}
$data[0] = $size;
$data[1] = $tables;
$data[2] = $rows;
return $data;
}
----
Manual Page -- http://www.php.net/manual/en/function.mysql-query.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40165
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40165&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40165&report=yes
Search -- http://master.php.net/manage/user-notes.php