Jump to content

[SOLVED] determining query and code question


ballhogjoni

Recommended Posts

I have 5 categories and I have 5-10 items in each category. How would I print the categories and the items in each category vertically like:

 

category

item

item

item

item

category

item

item

item

category

item

item

 

etc...

 

my code

$aOffers = $oZend_Db_Adapter_Pdo_Mysql->fetchAll('SELECT o.*,og.name FROM Offer as o LEFT JOIN Offer_group as og ON o.offer_group_id = og.group_id'); //returns an array
	foreach( $aOffers as $key => $item ){
		echo '<tr><td>'.$key.'</td></tr>';
	}

 

The table Offer holds the items and the table Offer_group holds the category. There is an fk the links these to tables as stated in the ON clause

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.