I have a category structure and subcategory. And you need to list all categories, and then your subcategories ... But the listing went wrong. I'm using codeigniter .
Database Structure:
SQLStructure:
SELECTc1.*,c2.id,c2.id_categoria,c2.categoriaasnome_categoriaFROMcategoriaASc1LEFTJOINcategoriaASc2ONc2.id_categoria=c1.id
HowdoIlistallcategoriesandsubcategoriesinthecorrectway?WithinthesameSQL,Iwilldothedatarecoverybyforeach()todisplayallcategoriesandtheirsubcategories.Todaytheresultlookslikethis:
Thisshouldbetheresult:
The health category should also come out in the example ...