From d8441d59243193db16fc9bb5aed9479858b68df5 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Wed, 30 Jul 2014 13:49:47 +0200 Subject: [PATCH] Added number of entries and removed doubled dblist --- c.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/c.php b/c.php index ceac41d..7ea3721 100644 --- a/c.php +++ b/c.php @@ -86,6 +86,13 @@ 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']; @@ -118,15 +125,16 @@ $con->connect(); echo json_encode($con->tableList($database)); break; - case "dblist": - $con->connect(); - echo json_encode($con->dbList()); - break; case "fieldlist": $con->connect(); $con->selectDb($database); echo json_encode($con->fieldList($table)); break; + case "numrows": + $con->connect(); + $con->selectDb($database); + echo $con->numRows($table); + break; case "query": $con->connect(); $con->query($query);