In the footsteps Forming queries to the table data, comparing and outputting the sum Created a query to the database, it is processed if run directly in phpmyadmin. How to integrate it into PHP
SELECT c.`id` , ( SELECT COUNT( * ) FROM `items_comments` WHERE `reply_to` = c.id ) AS сount FROM `items_comments` c WHERE c.`reply_to` = 0 Actually the request itself, but not processed, if you insert it like this:
public function ReplyCount($id) { global $mysql, $langArray; $mysql->query(" SELECT c.`id` , ( SELECT COUNT( * ) FROM `items_comments` WHERE `reply_to` = c.id ) AS сount FROM `items_comments` c WHERE c.`reply_to` = '0' "); return true; } Where ReplyCount is the value to be output. How to make it?