stupd question (I hope you dont mind)
Greetings rawhide, I got some mysql help from you yesterday and it was extremely useful. Anyway, you made a little scrpt for me so I could alternate row colors, you showed me that <td> and not <tr> has an attribute of bgcolor. Here's the code you gave me...
PHP Code:
for($i = 0; $i < $numofrows; $i++) {
if($i % 2) {
$bgcolor = "silver";
} else {
$bgcolor = "white";
}
while ($result = mysql_fetch_array($query)) {
print "<tr>";
print "<TD bgcolor=\"$bgcolor\">".$result['c_name']."</TD>";
print "<TD bgcolor=\"$bgcolor\">".$result['c_city'].", ".$result['c_state']."</TD>";
print "<TD bgcolor=\"$bgcolor\">".$result['c_desc']."</TD>";
print "<TD bgcolor=\"$bgcolor\">".$result['rationale']."</TD>";
print "<TD bgcolor=\"$bgcolor\">".$result['contact_name']."</TD>";
print "<TD bgcolor=\"$bgcolor\">".$result['contact_phone']."</td>";
print "<TD bgcolor=\"$bgcolor\">".$result['a_date_formatted']."</TD>";
print "<TD bgcolor=\"$bgcolor\">".$result['a_desc']."</TD>";
print "<TD bgcolor=\"$bgcolor\">".$result['a_next']."</TD>";
print "<TD bgcolor=\"$bgcolor\" ALIGN=CENTER>".$result['priority']."</TD>";
print "<TD bgcolor=\"$bgcolor\">".$result['medivas']."</td>";
print "</TR>\n";
}
}
The logic seems to be right, however, when I run it and look at the source, all the <td>s' have a bgcolor of white so is there something wrong with the if statement above?
You can see it in action here...(select the MediVas POC at the right)
http://www.lukesplace.com/Padilla/createreport.php