use a checker/variable, to check if there are already 5 colums already
// write codes to loop through each elements of the array
//here
$j = $i % 5; //$i = current index/pointer of your array of
if($j == 0){
echo "</td></tr><tr><td>";
}else{
echo "</td><td>";
}
this should do the trick. if its not working, because i am writing it from a cafe and my system is not here. so i can't test the code. just buzz me on 08058562158 to give you a better and debugged code