It would seem necessary to realize a simple thing - to display on the page a list of categories, next to each category the number of articles related to it. Here is my attempt, but in vain (this is a function that lists all categories):
//Показать все категории function categories() { $db = new SQLite3(DB_NAME); $results = $db->query("SELECT DISTINCT category FROM articles"); $articles = $db->querySingle("SELECT COUNT(*) as count FROM articles WHERE category LIKE '%$category%'"); while ($row = $results->fetchArray()) { echo 'Категория: <a href="?category=' . $row['category'] . '">' . $row['category'] . '</a> Статей: (' . $articles . ')'; } $db->close(); } Please tell me where my error is and how to fix it.
var_dump($articles);to the studio - Manitikyl 7:55 pmGROUP BYnot destiny? - ArchDemon