In the "GRANTS" part, do not define a default db name if a db is aleady selected

This commit is contained in:
Loïc Chapeaux
2002-03-17 14:51:00 +00:00
parent d5e10ad609
commit 46ca3d17bf
2 changed files with 14 additions and 5 deletions

View File

@@ -503,10 +503,14 @@ function PMA_grantOperations($grants)
// echo ' ';
// echo '<option></option>' . "\n";
// }
$result = mysql_query('SHOW DATABASES');
$is_selected_db = FALSE;
$result = mysql_query('SHOW DATABASES');
if (@mysql_num_rows($result)) {
while ($row = mysql_fetch_row($result)) {
$selected = (($row[0] == $dbgrant) ? ' selected="selected"' : '');
$selected = (($row[0] == $dbgrant) ? ' selected="selected"' : '');
if (!empty($selected)) {
$is_selected_db = TRUE;
}
echo ' ';
echo '<option' . $selected . '>' . $row[0] . '</option>' . "\n";
} // end while
@@ -602,7 +606,7 @@ function PMA_grantOperations($grants)
<tr>
<td colspan="5">
<?php echo $GLOBALS['strDatabaseWildcard'] . "\n"; ?>&nbsp;
<input type="text" name="newdb" value="<?php echo (!empty($pma_user)? $pma_user . '%':''); ?>" onchange="change(this)" />
<input type="text" name="newdb" value="<?php echo ((!$is_selected_db && !empty($pma_user)) ? $pma_user . '%' : ''); ?>" onchange="change(this)" />
</td>
<tr>
</table>