Hi again folks! I am not sure if I should start posting this stuff in the coding section or if this is considered newbie stuff still. Anyway, I am pulling results from a query into my page & am trying to get the results into a table that is 2 columns wide. I am also alternating the background color from row to row. I can get the results to alternate the background using the ternary operator, but am having trouble getting the records to echo correctly. It is obviously easy to get the records to just show a single record in each table row, but getting it to show 2 in one row & then continue on in the next row seems trickier.
Here is where I am at so far:
$bg = '#EEEEEE'; //set background color
while ($row = mysql_fetch_array ($result))
{ $bg = ($bg=='#EEEEEE' ? '#FFFFFF' : '#EEEEEE'); //switch background color
print '<table width="568" cellpadding="2">
<tr>
<td width="284" bgcolor="' .$bg. '">' .$row[subtype_name]. '</td>
<td width="284" bgcolor="' .$bg. '">' .$row[subtype_name]. '</td>
</tr>'; }
Obviously the problem here is that I am repeating the same result in both cells of each row before it loops and moves to the next result. I am sure I have to use some kind of count and or if loop, but am not sure where to begin. Any help would be awesome! Thanks!