您的位置:首页 > 数据库

利用smarty,从数据库中循环输出每一条记录

2014-10-31 20:58 274 查看
php文件中

$sql=mysql_query("select * from kehu_information where special is not null");

while($row=mysql_fetch_assoc($sql)){

    $table[]=$row;

}

 $smarty->assign('table',$table);

 $smarty->display('Smarty/templates/kehu.html');

html文件中

 <table class="table table-hover">

  

   <thead>

      <tr>

         <th>客户</th>

         <th>预算</th>

         <th>缴费</th>

       <th>缴费方式</th>

         

      </tr>

   </thead>

   

   

   

   

    <tbody>

      

   <{foreach from=$table  item=i}>

   <tr>

  <td><{$i.kehu}></td><td><{$i.yusuan}></td><td><{$i.jiaofei}></td><td><{$i.jiaofei_style}></td>

  </tr>

  <{/foreach}>

   

   </tbody>

</table>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐