用的哪个模板?
我用的是PEAR的ITX,给你看看:
$rs = $db->Execute('select * from sciforum');
$tpl = new HTML_Template_ITX("./template/");
$tpl->loadTemplatefile("test.tpl", true, true);while ( false == $rs->EOF ) 
{     $valueArray = array('name'=>$rs->fields[1], 'institution'=>$rs->fields[4]);
$tpl->setCurrentBlock("LIST");
$tpl->setVariable($valueArray);
$tpl->parseCurrentBlock(); $rs->MoveNext();

}
$tpl->show();就是三步:
1。赋值给变量
2。设置要解析的块
3。解析如果不是使用模板的问题,看看别的,比如:$db->get_num_rows($sort_f)是多少