pneudralics Posted November 3, 2008 Share Posted November 3, 2008 I'm trying to learn how to display data results in multiple column. Can't seem to get php to echo <tr> and </tr> after counting certain amount of data. //Retrieve gallery info $galleryselect = "SELECT * FROM gallery ORDER BY id ASC"; //Count results $count_gallery_result = mysql_query($galleryselect); //Get counted results $count_gallery = mysql_num_rows($count_gallery_result); if ($galleryresult = mysql_query ($galleryselect)) { while ($row = mysql_fetch_array ($galleryresult)) { $gallery = $row['image']; ?> <?php if ($count_gallery == 3) { echo '<tr>'; } echo "<td>$gallery</td>"; if ($count_gallery == 0) { echo '</tr>'; Quote Link to comment https://forums.phpfreaks.com/topic/131187-need-help-with-counting-data-and-echo-after-multiple-column/ 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.