problem to view double array

From: Date: Wed, 19 Nov 2003 10:50:50 +0000
Subject: problem to view double array
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10548@lists.php.net to get a copy of this message
Hi list I have problem to view this page, and I cant get it to work. Please, can anyone on the list help me to solve the problem? This is the way I want it too look. Have been strugeling too long now.... Grrrr!! Sorry for bad spelling :-) To generate the sql I use ADOdb. Thank you! texthead texthead - messhead - messhead texthead - messhead load-file.php ------------------------------------ $sql = "[sql]"; $result = $db->Execute($sql); $items = array (); while (!$result->EOF){ $item = array (); $item['texthead'] = $result->fields['texthead']; $items[] = $item; $lastone = $result->fields['textid']; //level two $sql2 = "select messhead from junior_mess where textid=$lastone"; $result2 = $db->Execute($sql2); $items2[$lastone] = array(); while (!$result2->EOF){ $items2[$lastone][] = array('messhead'=>$result2->fields['messhead']); $result2->MoveNext(); } $result->MoveNext(); } $smarty->assign("items", $items); $smarty->assign("items2", $items2); and here the template, tpl-file.tpl ---------------------------------------------------- {foreach from=$items key=one_id item=levelone} {$levelone.texthead}<br> {foreach from=$items2[$one_id] item=leveltwo} {$leveltwo.messhead}<br> {/foreach} {/foreach} ---------------------------------------------------- thanks alot! / JohannesF ----------------------------- Johannes Fosseus

« previous php.smarty.general (#10548) next »