jkkenzie Posted August 8, 2012 Share Posted August 8, 2012 I have this query: $query=" SELECT DISTINCT `mod_service`. * , `mod_service_categories` . * FROM `mod_service` LEFT JOIN `mod_service_categories` ON ( `mod_service_categories`.`Id` = `mod_service`.`catid` ) ORDER BY `mod_service_categories`.`priority` ASC "; I would like to use the result of this query to print out somthing like: 1. Category 1 (mod_service_category.name) a) subcategory 1 (mod_service.name plus other fields) b) subcategory 2 (mod_service.name plus other fields) c) subcategory 3 (mod_service.name plus other fields) 2. Category 2 (mod_service_category.name) a) subcategory 1 (mod_service.name plus other fields) b) subcategory 2 (mod_service.name plus other fields) and continues: am using foreach loop and still cant get what i want: thanks in advance: Link to comment https://forums.phpfreaks.com/topic/266801-echo-category-followed-by-subcategories-from-a-left-join-tables/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 8, 2012 Share Posted August 8, 2012 See the logic in the following post on how to 'remember' and detect when a heading value changes and take appropriate action - http://forums.phpfreaks.com/index.php?topic=328053.msg1544137#msg1544137 Link to comment https://forums.phpfreaks.com/topic/266801-echo-category-followed-by-subcategories-from-a-left-join-tables/#findComment-1367824 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.