diff --git a/ChangeLog b/ChangeLog index 1e21477c8..3679086e4 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ phpMyAdmin - Changelog $Id$ $Source$ +2001-08-28 Olivier Müller + * db_stats.php3: fixed the sql query so that the script won't + die, even if the result of one query (for example on invalid + db name) fails. + 2001-08-27 Robin Johnson * lib.inc.php3, db_readdump.php3 - removed expand_sql_query() as no longer needed diff --git a/db_stats.php3 b/db_stats.php3 index 0e12f3327..f89daaab7 100644 --- a/db_stats.php3 +++ b/db_stats.php3 @@ -136,17 +136,18 @@ if ($num_dbs > 1) { $tot_idx = 0; $tot_all = 0; $local_query = 'SHOW TABLE STATUS FROM ' . $db_clean; - $result = mysql_query($local_query) or mysql_die('', $local_query); - if (mysql_num_rows($result)) { - while ($row = mysql_fetch_array($result)) { - $tot_data += $row['Data_length']; - $tot_idx += $row['Index_length']; - } - $tot_all = $tot_data + $tot_idx; - $big_tot_all += $tot_all; - $big_tot_idx += $tot_idx; - $big_tot_data += $tot_data; - $results_array[$db] = $tot_all; + if ($result = @mysql_query($local_query)) { + if (mysql_num_rows($result)) { + while ($row = mysql_fetch_array($result)) { + $tot_data += $row['Data_length']; + $tot_idx += $row['Index_length']; + } + $tot_all = $tot_data + $tot_idx; + $big_tot_all += $tot_all; + $big_tot_idx += $tot_idx; + $big_tot_data += $tot_data; + $results_array[$db] = $tot_all; + } } list($tot_data_format,$unit_data) = format_byte_down($tot_data,3,1); @@ -154,7 +155,7 @@ if ($num_dbs > 1) { list($tot_all_format,$unit_all) = format_byte_down($tot_all,3,1); echo ' ' . "\n"; - echo '  ' . urlencode($db) . ' ' . "\n"; + echo '  ' . htmlentities($db) . ' ' . "\n"; echo '  ' . $num_tables . ' ' . "\n"; echo '  ' . $tot_data_format . ' ' . $unit_data . ' ' . "\n"; echo '  ' . $tot_idx_format . ' ' . $unit_idx . ' ' . "\n"; @@ -168,7 +169,7 @@ if ($num_dbs > 1) { list($tot_all_format,$unit_all) = format_byte_down($big_tot_all,3,1); echo ' ' . "\n"; - echo '  ' . $strSum . ' ' . "\n"; + echo '  ' . $strSum . ': ' . $num_dbs . '' . "\n"; echo '  ' . $tot_tables . ' ' . "\n"; echo '  ' . $tot_data_format . ' ' . $unit_data . ' ' . "\n"; echo '  ' . $tot_idx_format . ' ' . $unit_idx . ' ' . "\n";