Separate get_vals

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@144 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2007-07-11 22:04:08 +00:00
parent 1e0109cd2b
commit 7769f2c611
2 changed files with 12 additions and 5 deletions

View file

@ -49,11 +49,7 @@ function page_footer($missing = false) {
<select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)</option>
<?php
flush();
$result = $mysql->query("SHOW DATABASES");
while ($row = $result->fetch_row()) {
echo "<option" . ($row[0] == $_GET["db"] ? " selected='selected'" : "") . ">" . htmlspecialchars($row[0]) . "</option>\n";
}
$result->free();
echo optionlist(get_vals("SHOW DATABASES"), $_GET["db"], "not_vals");
?>
</select><?php if (isset($_GET["sql"])) { ?><input type="hidden" name="sql" value="" /><?php } ?></p>
<noscript><p><input type="submit" value="<?php echo lang('Use'); ?>" /></p></noscript>

View file

@ -29,6 +29,17 @@ function optionlist($options, $selected = array(), $not_vals = false) {
return $return;
}
function get_vals($query) {
global $mysql;
$result = $mysql->query($query);
$return = array();
while ($row = $result->fetch_row()) {
$return[] = $row[0];
}
$result->free();
return $return;
}
function fields($table) {
global $mysql;
$return = array();