Jump to content

echo category followed by subcategories from a left join tables


jkkenzie

Recommended Posts

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:

   

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.