First of all the
if ($id = 2)
..
should be
if ($id==2)
..
To work out if an $id is even, do something like
if (fmod($id, 2) == 0)
{
?> bgcolor='#ffffff'<? //this is an even number
}
else
{
?> bgcolor='#000000#'<? //this is an odd number
}
fmod is the modulus function, it basically gives you the remainder when dividing the 1st number by the 2nd number.
So if a number is even it is divisible exactly by 2, and therefore has a remainder of 0. An odd number has a remainder.
So we are saying, if $id/2 has no remainder then it is even, so display that colour,
else it must be odd, so have it as a different colour.
Jamie