PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm attemping to format alternate rows in a table with different colours
I reckon I'm missing a "foreach" command and equally that line 27 "$row = mysql_fetch_assoc($data))" is probably wrong..
I just can't figure it out.
Can anybody kindly volunteer the correct syntax?
Remember, HTML is all lowercase (<td>, not <TD>) and while bgcolor is valid enough, it is much better practice to use one style="background-color: [color];". Also, you may still want to look into that ternary operator, it is very useful for things like this.
-OmniUni
NOTE: Also, if you use instead a class="color1" and class="color2" it lets you set the background with CSS, so you can restyle your website easier. When possible, it is usually best to abstract your styling so that the HTML is as clean as possible.