Apologies for the vague title, I'm not sure what you might call this puzzle.
I have a list of Attributes and Variations in two tables. Variations belong to Attributes. For example :
Attributes = Size and Length
Variations =
Size.Small, Size.Medium, Size.Large,
Length.Short, Length.Regular, Length.Long
So an SQL search might return something like
'Attribute' => array(
'title' => 'Size',
'Variation' => array(
'title' => 'Small',
'title' => 'Medium',
'title' => 'Large',
),
'title' => 'Length',
'Variation' => array(
'title' => 'Short',
'title' => 'Regular',
'title' => 'Long',
),
)
What Im trying to do is present this to the browser as follows :
Small : Short
Small : Regular
Small : Long
Medium : Short
Medium : Regular
Medium : Long
Large : Short
Large : Regular
Large : Long
Bear in mind, the data may not be limited to just two Attributes, but could be several. Similarly with variations.
Is there a neat way to do this using array manipulation commands in PHP, or should it be done with foreach loops etc.
I suspect this may not be the right forum for this kind of question but if anyone can point me in the right direction it would be appreciated.