SELECT COUNT(DISTINCT g.id) AS cnt FROM `goods` g JOIN ( SELECT 101427 AS category_id UNION ALL SELECT `child_id` FROM `category_tree` WHERE `parent_id` = 101427 ) AS ct ON g.category_id = ct.category_id; WHERE 1

Fatal error: Uncaught Error: Call to a member function fetch_assoc() on bool in /html/catalog.php:246 Stack trace: #0 {main} thrown in /html/catalog.php on line 246