PHP ?? ????? ??? ??
?? ??? list.php
<!DOCTYPE html> <html lang="utf-8"> <head> <?php include ("conn.php"); ?> <link href="css.css" rel="stylesheet" type="text/css"> </head> <table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef" > <?php $sql="select * from message order by id desc"; $query=mysql_query($sql); while($row=mysql_fetch_array($query)){ ?> <tr bgcolor="#eff3ff"> <td>標題: <?php echo $row['title'];?> <font color="red">用戶: <?php echo $row['user'];?> </td> </tr> <tr bgColor="#ffffff"> <td>發(fā)表內容:<?php echo $row['content'];?></td> </tr> <tr bgColor="#ffffff"> <td><div align="right">時間:<?php echo $row['lastdate'];?></td> </tr> <?php } ?> <tr bgcolor="#f0fff0"> <td><div align="right"><a href="add.html">返回留言</a> </td> </tr> </table> </html>
CSS ??? ?? ? conn ?????? ?? ??
<?php $sql="select * from message order by id desc"; $query=mysql_query($sql); while($row=mysql_fetch_array($query)){ } ?>
?? ??? ??????? ??? ???????
mysql_queryQuery
mysql_fetch_array() - ??? ??? ???? ??
?? ?? ??? ???? ??? ?????
? ???? ???? ?? ????? ???? ?? ??? ??? ? ????. ??? ??? ???? ?? ??????.
? ?? ??:
HTML? PHP? ??? HTML ?? PHP ?? ?????.
????? ???? ???? ???? ?? ???? ? ?? ??? ?? ???? ?? ??? ? ?????.
mysql_query ? mysql_fetch_array() - ??? ??? ?? ???? ?? ? ? ?? ??? ?????.