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}

解决方案 »

  1.   

    php:while($row=mysql_fetch_array($res))
    {
        $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}
      

  2.   

    建议看大师兄的文章:http://blog.csdn.net/heiyeshuwu/archive/2004/12/06/206267.aspx
    http://blog.csdn.net/heiyeshuwu/archive/2004/12/06/206274.aspx
      

  3.   

    哈哈,谢谢二位,原来我{section}写的不对。tks
      

  4.   

    heiyeshuwu(黑夜路人) 哦,谢谢