From 46760ff7503cbe49b6223161f443100791b4ca2e Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Thu, 17 Jul 2014 12:44:12 +0200 Subject: [PATCH] Added action fieldlist --- c.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/c.php b/c.php index 2230384..f86d061 100644 --- a/c.php +++ b/c.php @@ -78,13 +78,12 @@ } function fieldList($table){ - $query = "SELECT * FROM `$table` LIMIT 0,1"; - $result_id = mysql_query($query); + $result_id = mysql_list_fields($this->database, $table); $numOfCols = mysql_num_fields($result_id); for($i=0;$i<$numOfCols;$i++) $result[$i] = mysql_field_name($result_id, $i); - + return $result; } } @@ -122,6 +121,11 @@ $con->connect(); echo json_encode($con->dbList()); break; + case "fieldlist": + $con->connect(); + $con->selectDb($database); + echo json_encode($con->fieldList($table)); + break; case "query": $con->connect(); $con->query($query);