Hi. I have a problem with my code.
My Database has 3 tables.
links (rows: id, link, linkorder )
sublinks1 (rows: id, sublink1, sublink1order, link, linkid )
sublinks2 (rows: id, sublink2, sublink2order, sublink1, sublink1id )
I am getting datas from the tables with this;
[php]$getdata=mysql_query(“select links.link, linkorder, sublinks1.sublink1, sublink1order, sublink2, sublinkid, sublink2sira from links, sublinks1, sublinks2 where linkid=links.id and sublinkid=sublinks1.id order by linkorder, sublink1order, sublink2order”);
[/php]
and after that
[php]while($row1=mysql_fetch_assoc($getdata))
{
$data[$row1[“link”]][$row1[“sublink1”]][$row1[“sublink2”]]=array($row1[“link”],$row1[“sublink1”],$row1[“sublink2”]);
}
[/php]
and then
[php]$smarty = new Smarty();
$smarty->assign(‘data’,$data);
[/php]
and tpl is here;
[php]{foreach key=link from=$data item=links}
-
{foreach key=sublink1 item=data from=$links name=sublink1ord}
-
{$sublink1}
-
{foreach key=sublink2 item=sublink2 from=$data name=sublink2ord}
- {$sublink2} {/foreach}
{/foreach}
it is work when all tables are filled… but if a table is empty it doesnt work…
Could you help me please