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>'; 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
Archived
This topic is now archived and is closed to further replies.