Home>

There is a request for data output from the database:

Select
    shop_type.type_name,
    shop_subtype.subtype_name
    shop_subtype_subtype.subtype_subtype_name.
From.
    Shop_Type.
Inner Join Shop_Subtype Inner Join SHOP_SUPTYPE_SUPE_ID= Shop_SubType.Type_id and shop_subtype.subtype_id= shop_subtype_subtype.subtype_id

you need to bring something like this:

when displaying the page via Foreach:

Help, please write a request for SQL or script to PHP to remove duplicate categories.

GROUP BY to help

InDevX2021-05-29 16:05:15

In SQL, this is not done, but you can in PHP. You need the resulting flat array to make a tree. On the Internet, probably full of examples

ArchDemon2021-05-29 16:22:39