while($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC)) { //$recTypes = array(); $recordElements[] = $row; $query2 = "select rt.rectypetitle from recordType rt,rtJoin rtj where (rt.recType_id = rtj.recType_id) and (rtj.record_id=". $row['record_id'].")"; $result2 = $connection->query($query2); while($row2 = $result2->fetchRow(MDB2_FETCHMODE_ASSOC)) { //$recTypes[$row['record_id']][] = $row2; $recTypes[] = $row2; } $recordElements["recTypes"] = $recTypes; } $smarty->assign('recElements',$recordElements); Template------ {foreach item=element from=$recElements} {$element.rec_short_description} //{$element.firstname},{$element.rec_where}
...............................................................
{*this is should only show results for the id passed from the outer query*} Category: {foreach item=type from=$element.recTypes} {$type.rectypetitle} spin
{/foreach}
The details are....
{$element.rec_detail_description}
...............................................................
{/foreach}