]> git.joonet.de Git - adminer.git/commitdiff
Separate get_vals
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 11 Jul 2007 22:04:08 +0000 (22:04 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 11 Jul 2007 22:04:08 +0000 (22:04 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@144 7c3ca157-0c34-0410-bff1-cbf682f78f5c

design.inc.php
functions.inc.php

index 312b150eeea35591aad8ce51f29d451fba5a1860..f6018c8a8925cd1140cecc0bed0c596b3928293f 100644 (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>
index 919ea25b522916f0b84e0850a8649bfc923b4ca5..9e9081a1d3d361ac8f585c7d9fc8d9d1ccb6498c 100644 (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();