三列PHP结果表

I'm trying to display my mysql query into a fairly unique table. The characteristics are as follows:

  1. The results table has 3 columns
  2. The top right cell is reserved for other content

[result1][result2][content]

[result3][result4][result5]

[result6][result7][result8]

...etc

The query can bring back as few as 1 result. But I'm struggling to get what i need included in the loop.

If anyone knows how to go after something like this, I'd love some help! Thanks in advance!

EDIT ** HERE IS MY CODE SO FAR

the results are coming through in three columns, but I can't get the condition to display other static content in the top right cell.

$row = 0;
$column = 0;
echo "<table>";
while($row = mysql_fetch_assoc($result)) {
    if ($column == 0) {echo "<tr>";}
    if (($column == 2) && ($row == 0)){echo "<td>content</td></tr><tr>";}
  echo "<td>".$row['business']."</td>";
  $column++;
  if ($column >= 3) {
    $row++;
    echo "</tr>";
    $column = 0;
  }
}
echo "</table>";

Assuming a pure html table, you'd have

$row = 0;
$column = 0;
echo '<table>';
while($row = mysql_fetch_assoc($result)) {
   if ($column == 0) {
      echo '<tr>';
   }
   if (($column == 2) && ($row = 0))
      echo '<td>content</td></tr><tr>'; // output special content, start new row
   }
   echo "<td>$row[something]</td>";
   $column++;
   if ($column >= 3) {
      $row++;
      echo '</tr>';
      $column = 0;
   }
}
echo '</table>';

probably won't work as-is, but should give you the general idea. Basically just output rows/columns until you reach the 1st row/3rd column then output your special content, otherwise just out

Once you have your results rows in $rows, split it into an array of arrays:

$table = array();
while (count($rows)){
   $group = array_slice($rows, 0, 3);
   $rows = array_slice($rows, 3);
   while (count($group) < 3) $group[] = array();
   $table[] = $group;
}

Now $table contains an array of 3-element arrays. The final one is padded to have 3 elements in it, adding empty arrays until we have 3. Then just output it:

foreach ($table as $group){
    echo "<tr>
";
    foreach ($group as $row){
        if ($row['id']){
            echo "<td>".format_data($row)."</td>
";
        }else{
            # empty padding cell on last row
            echo "<td>&nbsp;</td>
";
        }
    }
    echo "</tr>
";
}