From 24fc853e7bb482bca13cd4d39dbb421c7d863948 Mon Sep 17 00:00:00 2001
From: jakubvrana
Date: Mon, 7 Sep 2009 13:59:17 +0000
Subject: [PATCH] Select database before SHOW TABLES (bug #2853561)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1070 7c3ca157-0c34-0410-bff1-cbf682f78f5c
---
adminer/include/adminer.inc.php | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php
index 2233032a..bcc5feed 100644
--- a/adminer/include/adminer.inc.php
+++ b/adminer/include/adminer.inc.php
@@ -440,19 +440,15 @@ class Adminer {
select_db(DB)) {
$result = $dbh->query("SHOW TABLES");
- if (!$result) {
- echo "" . lang('No tables.') . "\n";
+ if (!$result->num_rows) {
+ echo "
" . lang('No tables.') . "\n";
} else {
- if (!$result->num_rows) {
- echo "
" . lang('No tables.') . "\n";
- } else {
- echo "
\n";
- while ($row = $result->fetch_row()) {
- echo '' . lang('select') . ' ';
- echo '' . $this->tableName(array("Name" => $row[0])) . "
\n"; //! Adminer::tableName may work with full table status
- }
+ echo "
\n";
+ while ($row = $result->fetch_row()) {
+ echo '' . lang('select') . ' ';
+ echo '' . $this->tableName(array("Name" => $row[0])) . "
\n"; //! Adminer::tableName may work with full table status
}
}
echo '
' . lang('Create new table') . "\n";