An error har occured.
', $e->getMessage(), '
'; } $sth = $dbh->query("SELECT c.*, count(qtc.categoryId) as questionCount " . "FROM Category c INNER JOIN QuestionToCategory qtc ON qtc.categoryId = c.id " . "GROUP BY c.id;"); $sth->setFetchMode(PDO::FETCH_ASSOC); $result = $sth->fetchAll(); if (count($result) > 0) { echo json_encode($result, JSON_UNESCAPED_UNICODE); }