Your problem is that you use the $cellvalue of the previous statement each time.
No offense, but you are making a simple task hard to read there.
I've rewrote this little code like this, and replaced the mysql datas by a generated array:
PHP Code:
<?php echo "<table cellpadding=\'2\' cellspacing=\'0\'>"; echo "<tr>"; echo "<td class=\"th\" >COL1</td>"; echo "<td class=\"th\" >COL2</td>"; echo "<td class=\"th\" >COL3</td>"; echo "</tr>"; $rowcount = 0; $group1_current_row = 0; $group2_current_row = 0; $group3_current_row = 0; $group4_current_row = 0; $group5_current_row = 0; $grouptotal_current_row = 0; $isStart01 = 0; $isStart02 = 0; $isStart03 = 0; $isStart04 = 0; $isStart05 = 0; //while ($row = mysql_fetch_array($result)) { for($i=1;$i<=10;$i++){ $records[$i][1]="$i::aaa"; $records[$i][2]="$i::bbb"; $records[$i][3]="$i::ccc"; $records[$i][4]="$i::ddd"; $records[$i][5]="$i::eee"; $records[$i][6]="$i::fff"; } foreach($records as $row){ if ($rowcount == 0) { $newgroupindex = -1; $css_class=(($rowcount%2) == 0)?"one":"two"; echo<<<HTML <tr> <td class="$css_class" align="default"> {$row[1]} </td> <td class="$css_class" align="default"> {$row[2]} </td> <td class="$css_class" align="default"> {$row[3]} </td> </tr> HTML; $newgroupindex = -1; $rowcount = $rowcount + 1; $isStart01++; $isStart02++; $isStart03++; $isStart04++; $isStart05++; } } echo "</table>"; ?>
Why would do 6 time "echo '<td...." when you can do everything into 1 echo.
And if you still have only 1 row, it surely means that your problem is in the sql query that provides you the datas, and not in the logic.
__________________
Listen to the ducky: "This is awesome!!!"
Last edited by tripy : 09-26-2007 at 10:55 AM.
|