Jump to content

[SOLVED] Okay, here's a crazy one for you....


Moron

Recommended Posts

Here's my code:

 

<?php
$RESULTMEMBER=mssql_query("select * from MemberInfo MI where BoardName='Youth Advisory Board' order by MI.[LName]");
$RESULTYAB=mssql_fetch_assoc($RESULTMEMBER);
$RESULTMEMBERCOUNT=mssql_num_rows($RESULTMEMBER);

echo "<CENTER>";

echo "<table width=100% border=0 cellpadding=0 cellspacing=0>";
echo "<TR>";
echo "<TD width=45% align=left valign=top color=green>";
echo "<font size=2 color=#000000 face=arial>";
echo "<b>Member/Address</b>"; 
echo "</TD>";
echo "<TD width=4% align=left valign=top>";
echo "<font size=2 color=#000000 face=arial>";
echo "<NOBR>";
echo "<b>Grade</b><BR><b>Level</b>";
echo "</NOBR>";
echo "<BR>";
echo "<BR>";
echo "</font>";
echo "</TD>";
echo "<TD align=center valign=top>";
echo "<font size=2 color=#000000 face=arial>";
echo "<b>Telephone</b>";
echo "</font>";
echo "</TD>";
echo "<TD align=right valign=top>";
echo "<font size=2 color=#000000 face=arial>";
echo "<b>Term Expires</b>";
echo "</TD>";
echo "</TR>";
echo "</font>";
echo "</TABLE>";

while ($RESULTYAB = mssql_fetch_assoc($RESULTMEMBER))   {

echo "<table width=100% border=0 cellpadding=0 cellspacing=0>";
echo "<TR>";
echo "<TD width=45% align=left valign=top>";
echo "<font size=2 color=#000000 face=arial>";
echo $RESULTYAB['FName']; 
echo " ";
echo $RESULTYAB['MName']; 
echo " ";
echo $RESULTYAB['LName']; 
echo " ";
echo "<font size=1 color=#000000 face=times new roman>";
echo "<NOBR>";
echo "<i>";
echo $RESULTYAB['Appointed']; 
echo "</i>";
echo "</NOBR>";
echo "</font>";
echo "<font size=2 color=#000000 face=arial>";
echo "<BR>";
echo "<NOBR>";
echo $RESULTYAB['Address']; 
echo "</NOBR>";
echo "<BR>";
echo "<BR>";
echo "</font>";
echo "</TD>";
echo "<TD width=4% align=right valign=top>";
echo "<font size=2 color=#000000 face=arial>";
echo $RESULTYAB['GradeLevel'];
echo "</font>";
echo "</TD>";
echo "<TD align=right valign=top>";
echo "<font size=2 color=#000000 face=arial>";
echo $RESULTYAB['HomePhone'];
echo "</font>";
echo "</TD>";
echo "</TD>";
echo "<TD align=right valign=top>";
echo "<font size=2 color=#000000 face=arial>";
$date = date("F j, Y", strtotime($RESULTYAB['TermExpires']));
echo $date;
echo "</TD>";
echo "</TR>";
echo "</font>";
echo "</TABLE>";
echo "</CENTER>";
}
?>

 

And here's a screenshot of what it produces (except with real names, addresses, phone numbers):

 

phpshot.jpg

 

So the crazy question is: is there a way to color the background of every

other row? I can't just use "<tr bgcolor=#??????>" because the rows are generated "while" data records are being listed.

 

I want to make it color every other row for ease of visualization.

 

What do you think?

 

Link to comment
Share on other sites

this goes after your query:

 

$css_class = ($css_class=='row_style_1') ? 'row_style_2' : 'row_style_1';

 

this goes in the tr:

 

<tr class=\"$css_class\">

 

here is the css:

 

.row_style_1, td.row_style_1

{

background-color: #eaeaea;

}

.row_style_2, td.row_style_2

{

background-color: #ffffff;

}

 

 

thanks to whoever's code this is, it helped me

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.