There is a table of files files as follows:
+-------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | dir_id | int(11) | NO | | NULL | | | title | varchar(255) | NO | | NULL | | +-------------+--------------+------+-----+---------+----------------+
and there is a dirs folder table:
+-----------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | parent_id | int(11) | NO | | 0 | | | title | varchar(50) | YES | | NULL | | +-----------+-------------+------+-----+---------+----------------+
It is necessary for a given ID to display the number of files in the category including internal folders.