function sizedatabase($data) {
if ($data < 1024) {
return $data . " bytes";
} else if ($data < 1024000) {
return round(( $data / 1024), 1) . " KB";
} else {
return round(( $data / 1024000), 1) . " MB";
}
}
$db = mysql_connect("localhost", "пользователь", "пароль");
mysql_select_db("БД", $db);
$result = mysql_query("SHOW TABLE STATUS");
$dbsize = 0;
while ($row = mysql_fetch_array($result)) {
$dbsize += $row["Data_length"] + $row["Index_length"];
}