There must be a easier way to do this:
it prints the size of a mysql database in Megabytes.
$query = mysql_query("SELECT data_length, index_length FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'pvs'");
while($data = mysql_fetch_array($query)){
$num[] = ($data['data_length'] + $data['index_length']);
}
for($i = 0; $i < count($num); $i++) {
$tot = $num[$i] / 1048576;
}
echo $tot;