I’m looking to alternate row colors using PHP function. Here’s what I have (although it does not work):
function row($year) {
if($year%2)
$color == "#FFF";
else
$color == "#000";
}
for ($year=2013; $year<=2023; $year++)
{
row($year);
echo "<tr bgcolor='$color'><td>$year</td><td>$tdate</td></tr>";
}
Basically, if a year is odd I would like the color of the row to be white. If even, black.
now what should you do is
however its looks like you are not aware of what
==does its a equal to operator its not assignment operatorwhat assignment operator do is assign right hand side value to left hand for example
what Comparison Operators(
==) do issecond you also there is the scope of a variable