Here's my guess. I'll test it later if I have time...
$query = 'SELECT `fieldName` FROM `myTable`'; // your query here, obviously
$exec = mysql_query($query) or die('MySQL Error: ' . mysql_error());
$data = array();
while($row = mysql_fetch_assoc($exec))
$data[] = $row;
echo "<table>\n";
for($i=0,$col=1; isset($data[$i]); $i++,$col++) {
if($col == 1)
echo "<tr>\n";
if(isset($data[$i+1]))
echo '<td>' . $data[$i]['fieldName'] . '</td>';
else {
echo '<td>' . $data[$i]['fieldName'] . '</td>';
while($col < 5) {
echo "<td> </td>\n</tr>";
$col++;
}
break;
}
if($col == 5) {
echo "\n</tr>\n";
$col = 0;
}
}
echo '</table>';
EDIT: Okay, so it's broken somewhere, I'm debugging it ATM. Feel free to help 🙂
EDIT2: Found the bug. Code snippet above works for me, assuming you fill in the SQL information and whatnot. If you'd like an explanation of the different structures and logic involved (i.e. if you want to learn and become better 😉), feel free to ask about anything that looks foreign to you.