This is what I am trying right now:
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<?php
$row1 = "#cfdafg";
$row2 = "#ffffff";
$rowcolor = $row1;
$result=mysql_query("select * from courses WHERE syllabus!='nos.php' ORDER BY title asc");
while ($courses = mysql_fetch_row($result)) {
printf ('<tr bgcolor="%s"><td> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">$courses[0] - $courses[2] $courses[1]</font></td><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">$courses["title"]</font></td></tr>', $rowcolor);
if ($rowcolor == $row1) $rowcolor = $row2;
elseif ($rowcolor == $row2) $rowcolor = $row1;
}
?>
</table>
It pulls the info out of the database and gives me the right number of rows - just doesn't print the info - it prints my variable name
Help!
Andrew Smith wrote:
I would like to output my data in a table generated by a database and would like to have each row alternate colors - just like this forum - I am fairly new to PHP and would really appreciate your help.