Well, it's an exercise, really, and it will be a pleasant bit of coding for you.
Let's layout the problem:
You have decided on a format -- a table with 9 rows of (labelled) data, up to 4 columns wide.
Typically you'd just show a row of data horizontally, so you'd query the database. Then get a row, like
$row=mysql_fetch_assoc($result);
foreach($row as $element){
echo "<td>$element</td>";
}
etc..
In this case, you're going to have add a couple of steps:
You'll need to loop through the rows, and organize them separately:
$mytableelements=array();
$rowcount=0;
while($row=mysql_fetch_assoc($result)){
foreach($row as $label=>$data){
$mytableelements[$rowcount][$label]=$data;
}
$rowcount++;
}
$mytableelements is nicely organized.
$rowcount tells you how many vertical rows you are going to have. In the example you gave, $rowcount would 7 (7 rows of results)
$mytableelements [0]['weight'] would contain 176.8
$mytableelements [1]['weight'] would contain 176.8
$mytableelements [2]['weight'] would contain 176.4
and so on:
Now you can create a while loop
$loopcount=0;
while($loopcount<$rowcount){
foreach($mytableelements[$loopcount] as $element){
echo "<td>$element</td>";
}
$loopcount++;
//check whether to break to new table
//every fourth loopcount will modulo to 0
if($loopcount%4==0){
//echo end of current table here
// echo start of new table here;
}
}
etc.
Hope this helps