porta325 Posted June 21, 2007 Share Posted June 21, 2007 $cell = 0; echo '<table><tr>'; foreach ($results as $result) { echo '<td>'.$result.'</td>'; $cell++; if ($cell == 2) { echo '</tr><tr>'; $cell = 0; } } echo '</tr></table>'; I have something like this and i wanna display an array on rows 3 by 3. EX: 1 2 3 4 5 6 7 8 9 Quote Link to comment https://forums.phpfreaks.com/topic/56522-loop-from-array/ Share on other sites More sharing options...
LazyJones Posted June 21, 2007 Share Posted June 21, 2007 if ($cell == 3) Quote Link to comment https://forums.phpfreaks.com/topic/56522-loop-from-array/#findComment-279161 Share on other sites More sharing options...
porta325 Posted June 21, 2007 Author Share Posted June 21, 2007 Not working, not even doing what it supposed to do. Quote Link to comment https://forums.phpfreaks.com/topic/56522-loop-from-array/#findComment-279164 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.