[PHP] 表格变色输出 →→→→→进入此内容的聊天室

来自 , 2020-03-03, 写在 PHP, 查看 112 次.
URL http://www.code666.cn/view/898dd88c
  1. <?php
  2. $result=mysql_query($sql);
  3. $color="1";
  4. echo '<table align="center" width="1000px" border="1px" cellspacing="0" cellpadding="2px">';
  5. echo '<tr bgcolor="silver">
  6. <th>id</th>
  7. <th>姓名</th>
  8. <th>留言内容</th>
  9. <th>ip地址</th>
  10. <th>留言时间</th>
  11. </tr>';
  12. while($rows=mysql_fetch_array($result)){  //mysql数据表隔行变色输出(变色输出)
  13. if($color==1){
  14. echo "<tr bgcolor='#FFC600'>
  15. <td>".$rows['id']."</td><td style='width:36px'>".$rows['name']."</td><td>".$rows['comment']."</td>
  16. <td style='width:171px'>".$rows['visitor_ip']."</td><td style='width:171px'>".$rows['time']."</td>
  17. </tr>";
  18. $color="2";
  19. }
  20. else {
  21. echo "<tr bgcolor='#C6FF00'>
  22. <td>".$rows['id']."</td><td>".$rows['name']."</td><td>".$rows['comment']."</td>
  23. <td>".$rows['visitor_ip']."</td><td>".$rows['time']."</td>
  24. </tr>";
  25. $color="1";
  26. }
  27. }
  28. echo '</table>';
  29.  
  30. ?>
  31.  
  32.  

回复 "表格变色输出"

这儿你可以回复上面这条便签

captcha