利用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>
$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>
相关文章推荐
- 数据库_MySQL_利用 存储过程 对 数据表 中的 每一条记录 进行业务处理
- 利用PreparedStatement对象实现在数据库中插入一条记录。
- 利用数据库表转置将多条记录合并成一条记录
- Mongo数据库(C驱动),将一条查询记录按脚本格式输出至std::string中
- smarty 里面如何判断 是最后一条记录 就不输出 “|”
- marquee 循环显示数据库中的记录,一次显示一条
- Delphi中ADODataSet如何循环输出每一条记录
- 利用P6SPY +SQL Profiler记录、统计web app对数据库的操作。
- C# 向数据库插入一条记录后,获得新插入记录的自动编号(id)
- 怎么从数据库中随机拿一条或几条记录?
- Sqlserver 2000 数据库表中删除重复记录(仅保留一条)
- 从数据库中选择各种分类各一条记录的方法
- 在ejb中直接利用jdbc读取数据库记录
- 利用JDBC获取数据库的记录
- php循环输出数据库内容的代码
- 数据库操作_连接SQL Server数据库示例;连接ACCESS数据库;连接到 Oracle 数据库示例;SqlCommand 执行SQL命令示例;SqlDataReader 读取数据示例;使用DataAdapter填充数据到DataSet;使用DataTable存储数据库表;将数据库数据填充到 XML 文件;10 使用带输入参数的存储过程;11 使用带输入、输出参数的存储过程示;12 获得数据库中表的数目和名称;13 保存图片到SQL Server数据库示例;14 获得插入记录标识号;Exce
- 自己写了一个把文章标题从数据库中读出,并且赋值给一个数组,最后通过smarty循环显示出来
- 删除一条数据库记录的解决方案
- 利用timestamp实现数据库处理同一记录的时间差异问题
- php循环输出数据库内容的代码