Added number of entries and removed doubled dblist

This commit is contained in:
Przemek Grondek 2014-07-30 13:49:47 +02:00
parent e876291afe
commit d8441d5924

16
c.php
View File

@ -86,6 +86,13 @@
return $result; return $result;
} }
function numRows($table){
$result_id = mysql_query("SELECT COUNT(*) as total_count FROM `$table`");
$ret = mysql_fetch_object($result_id);
return $ret->total_count;
}
} }
$action = $_GET['a']; $action = $_GET['a'];
@ -118,15 +125,16 @@
$con->connect(); $con->connect();
echo json_encode($con->tableList($database)); echo json_encode($con->tableList($database));
break; break;
case "dblist":
$con->connect();
echo json_encode($con->dbList());
break;
case "fieldlist": case "fieldlist":
$con->connect(); $con->connect();
$con->selectDb($database); $con->selectDb($database);
echo json_encode($con->fieldList($table)); echo json_encode($con->fieldList($table));
break; break;
case "numrows":
$con->connect();
$con->selectDb($database);
echo $con->numRows($table);
break;
case "query": case "query":
$con->connect(); $con->connect();
$con->query($query); $con->query($query);