5
I have a table called 'departments' with the following structure:
CREATE TABLE `departments` (
`id` tinyint(255) NOT NULL AUTO_INCREMENT,
`company_id` tinyint(255) NOT NULL,
`name` varchar(255) NOT NULL,
`parent_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=23;
In that table I have a department called Creating, still in that table I have another department called Programming who is the son of department Creating, the department Programming has a son named Front-End and so it goes, assuming that my user is set as Creating how can I catch all the levels below it including the children of children using Mysql and PHP?