From a68501772f30d1033b7d495d40c665ea9b0c167d Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sun, 22 Jul 2012 06:35:00 +0000 Subject: [PATCH] Tested the three new method mysql needed an adjustment. --- includes/classes/database.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/includes/classes/database.php b/includes/classes/database.php index 285cc53c89..1120ab3c33 100644 --- a/includes/classes/database.php +++ b/includes/classes/database.php @@ -216,8 +216,16 @@ include "root.php"; $prep_statement = $this->db->prepare(check_sql($sql)); $prep_statement->execute(); $tmp = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($tmp as &$row) { - $result['name'][] = $row['name']; + if ($this->type == "pgsql" || $this->type == "sqlite") { + foreach ($tmp as &$row) { + $result['name'][] = $row['name']; + } + } + if ($this->type == "mysql") { + foreach ($tmp as &$row) { + $table_array = array_values($row); + $result['name'][] = $table_array[0]; + } } return $result; } @@ -267,6 +275,7 @@ include "root.php"; //get the table info $table_info = $this->table_info(); + //set the list of fields if ($this->type == "sqlite") { foreach($table_info as $row) { @@ -280,9 +289,10 @@ include "root.php"; } if ($this->type == "mysql") { foreach($table_info as $row) { - $result['name'][] = $row['name']; + $result['name'][] = $row['Field']; } } + //return the result array return $result; }