Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Separate get_vals

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@144 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
commit 7769f2c611540173797a6b91122085f16c9b2332 1 parent 1e0109c
jakubvrana authored
Showing with 12 additions and 5 deletions.
  1. +1 −5 design.inc.php
  2. +11 −0 functions.inc.php
6 design.inc.php
View
@@ -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>
11 functions.inc.php
View
@@ -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();
Please sign in to comment.
Something went wrong with that request. Please try again.