require 'smarty.inc.php';//引入smarty
require 'configs/mysql_db.php'; //引入配置文件
global $_smarty;
$sql="select * from news";
$res=mysql_query($sql);
$_row=array();
while(r =mysql_fetch_assoc($res)){
$_row[]= r
}
$_smarty->assign('row',$_row);
$_smarty->display('index.html');
?>
注意mysql_fetch_assoc只能取出一条记录
HTML: