* 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.
This commit is contained in:
Olivier Müller
2001-08-28 07:51:10 +00:00
parent da0ce8fbec
commit 270a0f4a26
2 changed files with 19 additions and 13 deletions

View File

@@ -5,6 +5,11 @@ phpMyAdmin - Changelog
$Id$
$Source$
2001-08-28 Olivier M<>ller <om@omnis.ch>
* 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 <robbat2@orbis-terrarum.net>
* lib.inc.php3, db_readdump.php3
- removed expand_sql_query() as no longer needed

View File

@@ -136,7 +136,7 @@ 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 ($result = @mysql_query($local_query)) {
if (mysql_num_rows($result)) {
while ($row = mysql_fetch_array($result)) {
$tot_data += $row['Data_length'];
@@ -148,13 +148,14 @@ if ($num_dbs > 1) {
$big_tot_data += $tot_data;
$results_array[$db] = $tot_all;
}
}
list($tot_data_format,$unit_data) = format_byte_down($tot_data,3,1);
list($tot_idx_format,$unit_idx) = format_byte_down($tot_idx,3,1);
list($tot_all_format,$unit_all) = format_byte_down($tot_all,3,1);
echo ' <tr bgcolor="'. $bgcolor . '">' . "\n";
echo ' <td>&nbsp;' . urlencode($db) . '&nbsp;</td>' . "\n";
echo ' <td>&nbsp;' . htmlentities($db) . '&nbsp;</td>' . "\n";
echo ' <td align="right">&nbsp;' . $num_tables . '&nbsp;</td>' . "\n";
echo ' <td align="right">&nbsp;' . $tot_data_format . ' ' . $unit_data . '&nbsp;</td>' . "\n";
echo ' <td align="right">&nbsp;' . $tot_idx_format . ' ' . $unit_idx . '&nbsp;</td>' . "\n";
@@ -168,7 +169,7 @@ if ($num_dbs > 1) {
list($tot_all_format,$unit_all) = format_byte_down($big_tot_all,3,1);
echo ' <tr>' . "\n";
echo ' <th>&nbsp;' . $strSum . '&nbsp;</th>' . "\n";
echo ' <th>&nbsp;' . $strSum . ':&nbsp;' . $num_dbs . '</th>' . "\n";
echo ' <th align="right">&nbsp;' . $tot_tables . '&nbsp;</th>' . "\n";
echo ' <th align="right">&nbsp;' . $tot_data_format . ' ' . $unit_data . '&nbsp;</th>' . "\n";
echo ' <th align="right">&nbsp;' . $tot_idx_format . ' ' . $unit_idx . '&nbsp;</th>' . "\n";