MySQL query result

dragon2309

P.I Dragon
Hi, as some of you may know from helping me in the past i run a website which uses MySQL and PHP. Its curently under-going a makeover and i needa bit of help on the result table that the query results are echoed into.

the page is at www.simplytrue.co.uk/stocklist/test2.php

What i want is for the first row of the table to be in colour 1 and the second to be in colour 2 and the third to be in colour 1, so its alternating down the rows in two different colours. I know it can be done but i just cant work it out at all.....

Any ideas...

dragon2309
 
maybe you coudl write a script so that if the result was an even number it was one colour, say blue but if it wasn't make it pink, so i think it would be something like this to be inserted in the <tr bgcolor> of the table
<?php
if($result == $even) {
echo "bgcolor=\"#FF0000\"";
} ELSE{
echo "bgcolor=\"#FF00FF\"";
}
?>
but i don;t know what the php equivalent for an even number is, maybe you coudl write some script that worked it out, i don#t really know much about php and mysql databases, i just end up with loads of errors
 
ok, thanks lee, ive been following those instructions word for word each time for about an hour and a hlaf now and i cant get it to work at all, jsut throws up errors about an unexpected T_VARIABLE. Stupid PHP.

It's not crucial that it works but it would be nice to see it in action.
 
Back
Top