a.php
<?php
...
...
$smarty->assign("rs",$result);
$smarty->display("a.tpl");
?>a.tpl
{section name=rs loop=$rs}
<table>
<tr>
<td>
{$rs[rs].segmentname}
</td>
</tr>
</table>
{/section}
<?php
...
...
$smarty->assign("rs",$result);
$smarty->display("a.tpl");
?>a.tpl
{section name=rs loop=$rs}
<table>
<tr>
<td>
{$rs[rs].segmentname}
</td>
</tr>
</table>
{/section}
{
$list[] = array(
'area' => $row[地区],
'renkou' => $row[人口],
'qty' => $row[数量]
);
}template:
地区 人口 数量
<br>
{section name="l" loop="$list"}
{$list[l].area} {$list[l].renkou} {$list[l].qty} <br>
{/section}
http://blog.csdn.net/heiyeshuwu/archive/2004/12/06/206274.aspx