What you do is putting all table rows in one line, although you defined a 3-column-table.
You have to nest 2 loops:
First, your while loop as you did;
Then, inside this loop, a second loop incrementing from 1 through 3, making somthing like:
- insert a <tr> if 1
- insert a <td>[DATA]</td> if 1, 2 or 3
- insert a </tr> if 3
- reset to 1
I hope you understand what I mean, but I am am too tired tonight to do the complete coding of this.
Note: Remove your <tr> before and the </tr> behind the first loop!
Have a nice day,
JJ Mouris