if ($_REQUEST['act'] == 'list')
{
$smarty->assign('action', $_REQUEST['act']);
$where = 'where 1';//横真
$where .= " AND goods_name<>'' ";//判断字段不为空
$where .= " AND cat_id =2934 ";//指定表中字段特定ID
$listm = $GLOBALS['db']->getAll("SELECT goods_id,cat_id, goods_name,last_update FROM " .$GLOBALS['ecs']->table('goods').$where."limit 25" );//数据库中查询
$smarty->assign('listm',$listm);//赋值
$smarty->display('shangpin.dwt');//执行php文件
<table class="ve-table">
<tbody>
<tr class="length-01">
<th>商品名称</th>
<th>最新更新时间</th></tr>
<!-- {foreach from=$listm item=list }-->//遍历二维数组
<tr>
<td class="length-01">
<a href="shangpin.php?id={$list.goods_id}">
<span style="color:red;">*</span> {$list.goods_name}</a></td>//输出名称
<td class="length-01">
<a href="shangpin.php?id={$list.goods_id}"> {$list.last_update}</a></td>
</tr>
<!--{/foreach}--></tbody>
</table>
//