I have a quick question about using pictures with a PHP site. I have a table with the following fields:
thumbnail
original
caption
I also have a news section and some reports contain images and some do not. I have the pictures loading for the particular news story no problem. My news section is a specified width so at the end of each story I want a series of thumbnails at the bottom. What I want to do is have the thumbnails load, and if they get to a stage where there are more than for, a new table row is created, as at present they just go wild and overlap my content.
So far on my page I have the following setup
Code:echo '<table>'; echo '<tr>'; getnewsimages($newsid); <-- this calls the method for the picture with the news story id echo '</tr>'; echo '</table>';
My method then contains this code, and this creates the first line correctly, moves to the second but then creates a new row every time a thumbnail is generated:
It is probably a schoolboy error but I was wondering if anyone can see the obvious mistake/omission?Code:while ($row = mysql_fetch_array($gallery)) { $thumbnail = $row['thumbnail']; $original = $row['original']; $caption = $row['caption']; ++$count; if ($count <= "4") { echo '<td>'; echo '<img src="'.$thumbnail.'">'; echo '</td>'; } elseif ($count > "4") { echo '<tr>'; echo '<td>'; echo '<img src="'.$thumbnail.'">'; echo '</td>'; }





Bookmarks