<?php |
$result =mysql_query( $sql ); |
$color = "1" ; |
echo '<table align="center" width="1000px" border="1px" cellspacing="0" cellpadding="2px">' ; |
echo '<tr bgcolor= "silver" > |
<th>id</th> |
<th>姓名</th> |
<th>留言内容</th> |
<th>ip地址</th> |
<th>留言时间</th> |
</tr>'; |
while ( $rows =mysql_fetch_array( $result )){ //mysql数据表隔行变色输出(变色输出) |
if ( $color ==1){ |
echo "<tr bgcolor= '#FFC600' > |
<td> ".$rows['id']." </td><td style= 'width:36px' > ".$rows['name']." </td><td> ".$rows['comment']." </td> |
<td style= 'width:171px' > ".$rows['visitor_ip']." </td><td style= 'width:171px' > ".$rows['time']." </td> |
</tr>"; |
$color = "2" ; |
} |
else { |
echo "<tr bgcolor= '#C6FF00' > |
<td> ".$rows['id']." </td><td> ".$rows['name']." </td><td> ".$rows['comment']." </td> |
<td> ".$rows['visitor_ip']." </td><td> ".$rows['time']." </td> |
</tr>"; |
$color = "1" ; |
} |
} |
echo '</table>' ; |
?> |
by: 发表于:2017-10-16 17:25:09 顶(1) | 踩(1) 回复
??
回复评论