在查询生成的表上交替行颜色? [英] alternating row colors on query generated table?

查看:83
本文介绍了在查询生成的表上交替行颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有某种方法可以使表格具有交替的行颜色

您使用WHILE语句生成表格数据?

你知道吗,行1有灰色BG,第2行是白色,第3行是灰色,4是白色,

等等,只要有数据。

这里'我正在使用的是:


$ query_RSwho =" SELECT * FROM tbl_indv ORDER BY name ASC" ;;

$ RSwho = @ mysql_query($ query_RSwho,$ connection)或死(无法查询:

.. mysql_error());

while($ row_RSwho = mysql_fetch_array ($ RSwho)){

if($ row_RSwho [''name'']!=" X"){

$ names。="< tr align = left>< td

width = 120>"。$ row_RSwho [''name'']。"< / td>< td

align = left>& nbsp; - & nbsp;"。$ row_RSwho [''email'']。"< / td>< / tr>" ;;

}

}


所以,在那个WHILE部分,是否有办法替换bgcolor表格单元格

标签?

如果有网站或某事,请指点我? =)

谢谢!

Liam

Is there some way to make a table have alternating colors for rows when
you''re generating the table data with a WHILE statement?
You know, row 1 has a gray BG, row 2 is white, row 3 is gray, 4 is white,
etc, for as long as there''s data.
Here''s what I''m using right now:

$query_RSwho = "SELECT * FROM tbl_indv ORDER BY name ASC";
$RSwho = @mysql_query($query_RSwho, $connection) or die("Couldn''t query: "
.. mysql_error());
while ($row_RSwho = mysql_fetch_array($RSwho)) {
if ($row_RSwho[''name''] != "X") {
$names .= "<tr align=left><td
width=120>".$row_RSwho[''name'']."</td><td
align=left>&nbsp;--&nbsp;".$row_RSwho [''email'']."</td></tr>";
}
}

So, in that WHILE section, is there a way to alternate bgcolor table cell
tags?
If there''s a web site, or something, just point me? =)
Thanks!
Liam

推荐答案

query_RSwho =" SELECT * FROM tbl_indv ORDER BY name ASC" ;;
query_RSwho = "SELECT * FROM tbl_indv ORDER BY name ASC";


RSwho = @mysql_query(
RSwho = @mysql_query(


query_RSwho,
query_RSwho,


这篇关于在查询生成的表上交替行颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆