作用是循环表格
<?php
….
….
while($row=mysql_fetch_array($query)){
?>
<table width=500 border="0" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<tr><td>用户:<?php echo $row[user]; ?></td></tr>
<tr bgcolor="#eff3ff"><td>标题:<?php echo $row[title] ?> </td><tr>
<tr bgColor="#ffffff"><td>内容:<?php echo $row[content]; ?></td></tr>
</table>
<?php
}
?>
$sql="insert into message (user,title,content,lastdate) values ('$_POST[user]','$_POST[title]','$_POST[content]',now())";
获取数据库内容
本文介绍了一种使用PHP从数据库中获取数据并利用while循环结构进行遍历展示的方法。通过具体的代码实例,展示了如何设置表格样式及填充内容,包括用户、标题和详细内容等字段。
2563

被折叠的 条评论
为什么被折叠?



