diff --git a/Database.php b/Database.php index df02e7b..c37b4cb 100644 --- a/Database.php +++ b/Database.php @@ -29,7 +29,8 @@ class Database } else { $data = null; } - //$this->create_response($data, $error); + $query_response=array('data' => $data, 'error' => $error); + return $query_response; } function create_response($data, $error) { diff --git a/start.php b/start.php index f6a3e1c..181687b 100644 --- a/start.php +++ b/start.php @@ -11,7 +11,7 @@ $length = ($_GET['length'] && gettype(+$_GET['length']) == 'integer') ? +$_GET['length'] : 10; $database = new Database(); - $questions_count = $database->query('SELECT COUNT(*) FROM "Questions"'); + $questions_count = $database->query('SELECT COUNT(*) FROM "Questions"')['data']; echo pg_last_error(); echo $questions_count;