PHP循环输出数据库表中字段内容
<divclass="tab_title"><ahref="/?p=bulletin">更多...</a><imgsrc="/images/pin.gif"align="...
<div class="tab_title"><a href="/?p=bulletin">更多...</a><img src="/images/pin.gif" align="absmiddle" />最新公告</div>
<?
$str_sql=('SELECT * FROM messages WHERE type = 2 AND status is null ORDER BY createtime DESC limit 5' );
$result = $pdo->query($str_sql);
foreach($result as $r) {
print_array($r['createtime']);
print_array($r['title']);
?>
<table align="center" class="form-content" width="100%" style="border:0px solid #C0C0C0;float:left; " cellpadding="0" cellspacing="1">
<tr>
<td width="50%"><?$r['createtime']?></td>
<td width="50%"><a href="/?p=bulletin|<?$r['id']?>"><?$r['title']?></a></td>
</tr>
</table>
<? }
//exit;
?>
</div>
我现在能打印出$r['createtime内容,但是如何让它在table中显示出来? 展开
<?
$str_sql=('SELECT * FROM messages WHERE type = 2 AND status is null ORDER BY createtime DESC limit 5' );
$result = $pdo->query($str_sql);
foreach($result as $r) {
print_array($r['createtime']);
print_array($r['title']);
?>
<table align="center" class="form-content" width="100%" style="border:0px solid #C0C0C0;float:left; " cellpadding="0" cellspacing="1">
<tr>
<td width="50%"><?$r['createtime']?></td>
<td width="50%"><a href="/?p=bulletin|<?$r['id']?>"><?$r['title']?></a></td>
</tr>
</table>
<? }
//exit;
?>
</div>
我现在能打印出$r['createtime内容,但是如何让它在table中显示出来? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询