From c1dbe4b57d9c4e633a5fe4bc3359ff82f056dc66 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Tue, 20 Apr 2004 21:15:28 +0000 Subject: [PATCH] Fixed an error that occured when adding privileges to non-existant or wildcarded tables. --- ChangeLog | 2 ++ server_privileges.php | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 655677580..861a9776a 100755 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ $Source$ * Documentation.html, README: - The MySQL 4.1 support is not experimental anymore; - Updated credits. + * server_privileges.php: Fixed an error that occured when adding + privileges to non-existant or wildcarded tables. 2004-04-20 Marc Delisle * libraries/tbl_change.js: was always returning current day diff --git a/server_privileges.php b/server_privileges.php index 3b1346b78..80cc7d1a4 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -193,17 +193,19 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = $row[$current_grant . '_priv'] = in_array($current_grant, $users_grants) ? 'Y' : 'N'; } unset($row['Table_priv'], $current_grant, $av_grants, $users_grants); - $res = PMA_DBI_query('SHOW COLUMNS FROM `' . $db . '`.`' . $table . '`;'); + $res = PMA_DBI_try_query('SHOW COLUMNS FROM `' . $db . '`.`' . $table . '`;'); $columns = array(); - while ($row1 = PMA_DBI_fetch_row($res)) { - $columns[$row1[0]] = array( - 'Select' => FALSE, - 'Insert' => FALSE, - 'Update' => FALSE, - 'References' => FALSE - ); + if ($res) { + while ($row1 = PMA_DBI_fetch_row($res)) { + $columns[$row1[0]] = array( + 'Select' => FALSE, + 'Insert' => FALSE, + 'Update' => FALSE, + 'References' => FALSE + ); + } + PMA_DBI_free_result($res); } - PMA_DBI_free_result($res); unset($res, $row1); } if (!empty($columns)) {