You are not logged in. Login or Signup
Home » Messageboard » XXX » Message 26778 (Thread)

# HELP!!!
i know this is an artsy fartsy message board ;o) but i need a bit of help with PHP.

I'm printing the results from a table and i need it to display alternate lines in different colours. i know it has something to do with odd and even numbers (i have a numeric reference for each line!) but i don't know how to code it!!

Can anyone help? i know a few of you are PHP gurus!

Thanks muchly!

Andy
(, Mon 25 Feb 2002, 11:08, archived)
# er. psuedo code
$counter=0

while (not done all table)
{
$counter++;

if (counter is odd)
{echo "black table line";}
else
{echo "white table line";}
}

see? do you see?
(, Mon 25 Feb 2002, 11:19, archived)
# Nice fast way of
figuring out if a number is odd or even:

if ( number & 1 )
{
/* Number is odd */
} else {
/* Number is even */
}

(thats C, but should be easy to convert to whatever language you want. Never done PHP myself...)
(, Mon 25 Feb 2002, 11:21, archived)
# Thanks guys!
Thats everything i needed!
(, Mon 25 Feb 2002, 11:29, archived)