Added action fieldlist

This commit is contained in:
Przemek Grondek 2014-07-17 12:44:12 +02:00
parent c2623224cd
commit 46760ff750

10
c.php
View File

@ -78,13 +78,12 @@
} }
function fieldList($table){ function fieldList($table){
$query = "SELECT * FROM `$table` LIMIT 0,1"; $result_id = mysql_list_fields($this->database, $table);
$result_id = mysql_query($query);
$numOfCols = mysql_num_fields($result_id); $numOfCols = mysql_num_fields($result_id);
for($i=0;$i<$numOfCols;$i++) for($i=0;$i<$numOfCols;$i++)
$result[$i] = mysql_field_name($result_id, $i); $result[$i] = mysql_field_name($result_id, $i);
return $result; return $result;
} }
} }
@ -122,6 +121,11 @@
$con->connect(); $con->connect();
echo json_encode($con->dbList()); echo json_encode($con->dbList());
break; break;
case "fieldlist":
$con->connect();
$con->selectDb($database);
echo json_encode($con->fieldList($table));
break;
case "query": case "query":
$con->connect(); $con->connect();
$con->query($query); $con->query($query);