have a variable called $count.
Set it to 0 before you loop through your results.
Each time through the results, check it.
If it is 0, print the opening table and tr tags then the < td > your data < / td >
If it is one or two simply print your data with the td tags.
If it is 3, print the data then your closing < /tr > and < /table > tags.
After checking it and printing the data, add 1. It it 3 set it back to 0.
This can also be helpful for printing rows in alternating colors.
Chris