Well, first of all Ill just scrap you script since this one is so easy its better to do it from scratch.
OK, somewhere in your script you have the code that accually aoutputs the tables you are working with. Im refferring to lines here, and Im meaning the bottom of this document which is the scipt you posted, and I have numbered the lines. Overview of your script. Line 5 - we print out the table header Line 11 - 23 is the loop which prints out all the lines, or rows. Line 24 closes the table. So what we have to do? First we need to declare the values we want to use as backround colours, lets use logical names : (fig a) $backcolor1="#fafafa"; $backcolor2="#c0c0c0"; $backcolor=$backcolor1; // we assign color 1 This code has to be written before the loop starts, so somewhere before line 11. In the loop (11-23) we need to switch between the colours where we write the colour of the <tr>. So we write something like : (fig b) echo '<tr style="background-color:' . $backcolor . ';">'; // continue with the rest of <td....... </td></tr> here // which is -> your code. This will print out the first background color, nice. Now we need it to switch color, so we need to add a little logic. This will be inserted right before the loop ends (infact, you can put it where ever you like aslong as its in the loop). (fig c) if($backcolor=backcolor1) $backcolor=$backcolor2; else $backcolor=$backcolor1; As you see above the logic is quite simple, if the color is 1 -> we set it to 2, else we set it to 1. If you think of it, if you process this logic over and over again you will infact get 1, 2, 1, 2, 1, 2, 1, 2 all the time, :) Nice! There you have it, and I hope you got the hang of it. To take your code and implement my colorswither all you need to do is, 1. On line 21 replace #000000 width $backcolor 2. Insert the logic (figc), all lines, into line 19 3. Place fig a in line 4. -- Kim Steinhaug --------------------------------------------------------------- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --------------------------------------------------------------- The code for return the top ten result is : 1 $result = mysql_query("SELECT * FROM albums where id <15"); 2 3 $Count = @mysql_num_rows($result); 4 5 echo "<table border=1 cellpadding=3 cellspacing=0 6 bordercolor='#000000'>\n"; 7 echo "<tr><td bgcolor='#666666'>ID</td><td 8 bgcolor='#666666'>ARTIST</td><td bgcolor='#666666'>TITLE</td><td 9 bgcolor='#666666'>LABEL</td><td bgcolor='#666666'>PRICE</td></tr>\n"; 10 11 for ($count = 0; $count < $Count; $count++) { 12 // Extract post details from database 13 $myrow = mysql_fetch_array($result); 14 $id = $myrow ['id']; 15 $artist = $myrow ['artist']; 16 $title = $myrow ['title']; 17 $label = $myrow ['label']; 18 $price = $myrow ['price']; 19 20 printf("<tr 21bgcolor='#000000'><td>$id</td><td>$artist</td><td>$title</td><td>$label</t d> 22<td>£$price</tr>\n"); 23} 24 echo "</table>\n"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php