Get all child, grandchild etc nodes under parent using php with mysqli

Demo Tutorial Link - Mostlikers Blog www.mostlikers.com

Array
(
    [products] => Array
        (
            [0] => Array
                (
                    [name] => Electronics
                    [children] => Array
                        (
                            [0] => Array
                                (
                                    [name] => Mobiles
                                    [children] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [name] => Moto
                                                    [children] => Array
                                                        (
                                                            [0] => Array
                                                                (
                                                                    [name] => Moto g
                                                                    [children] => Array
                                                                        (
                                                                        )

                                                                )

                                                            [1] => Array
                                                                (
                                                                    [name] => Moto e
                                                                    [children] => Array
                                                                        (
                                                                        )

                                                                )

                                                        )

                                                )

                                            [1] => Array
                                                (
                                                    [name] => Samsung
                                                    [children] => Array
                                                        (
                                                        )

                                                )

                                        )

                                )

                            [1] => Array
                                (
                                    [name] => Tablets
                                    [children] => Array
                                        (
                                        )

                                )

                        )

                )

            [1] => Array
                (
                    [name] => Clothing
                    [children] => Array
                        (
                            [0] => Array
                                (
                                    [name] => Men
                                    [children] => Array
                                        (
                                        )

                                )

                            [1] => Array
                                (
                                    [name] => Woman
                                    [children] => Array
                                        (
                                        )

                                )

                        )

                )

            [2] => Array
                (
                    [name] => Books
                    [children] => Array
                        (
                            [0] => Array
                                (
                                    [name] => Summer Reads
                                    [children] => Array
                                        (
                                        )

                                )

                            [1] => Array
                                (
                                    [name] => Story book
                                    [children] => Array
                                        (
                                        )

                                )

                        )

                )

        )

)