derek barnstorm Posted July 1, 2007 Share Posted July 1, 2007 Hi, I am using the following script to display images on a page from a database: <script type="text/javascript"> function openpopup(popurl){ var winpops=window.open(popurl,"","width=610px,height=625px,resizable") } </script> </p>Click picture to enlarge.</p> <table cellpadding="4" cellspacing="0" width="100%"> <tr> <? $db = @mysql_select_db($db_name, $connection) or die("Couldn't select database."); $sql = "SELECT * FROM $tbl_images WHERE directory = \"$directory\""; $result = @mysql_query($sql,$connection) or die("Couldn't execute query."); while ($row = mysql_fetch_array($result)) { if($row[default_pic] == "yes") { $default_border = "1"; } else { $default_border = "0"; } $showimg="/$userdir/$row[url]/$row[image]"; $location ="$row[directory]/$row[image]"; if($profile_id == $auth[member_id]) { $del_pic = "<form action=\"../../include/profiles/delete_pic.php\" method=\"POST\"><input type=\"hidden\" name=\"file\" value=\"$row[image]\"><input type=\"hidden\" name=\"filename\" value=\"$location\"><input type=\"hidden\" name=\"image_id\" value=\"$profile_id\"><input type=\"submit\" value=\"Delete\"></form>"; } else { $del_pic = ""; } if($profile_id == $auth[member_id]) { $default_pic = "<form action=\"../../include/profiles/make_default.php\" method=\"POST\"><input type=\"hidden\" name=\"file\" value=\"$row[image]\"><input type=\"hidden\" name=\"profile_id\" value=\"$profile_id\"><input type=\"submit\" value=\"Default\"></form>"; } else { $default_pic = ""; } echo "<td align=\"center\" valign=\"top\"><p><a href=\"javascript:openpopup('showpic.php?img=$row[image]')\"><IMG SRC=\"../../thumbs/phpThumb.php?src=$showimg&w=200\" border=\"$default_border\"></a></p><p>$del_pic $default_pic</p></td></tr><tr>"; } ?> </tr> </table> <p align="center">Back to <a href="<?echo $PHP_SELF ?>">my profile.</a></p> But, when the iages are displayed, they appear in a list. What I want is to have them appear in 3 colums at a time... i.e. <td>myimage.jpg</td><td>myimage.jpg</td><td>myimage.jpg</td> </tr> <tr> <td>myimage.jpg</td><td>myimage.jpg</td><td>myimage.jpg</td> </tr> How would I go about doing this? Thanks, Des Link to comment https://forums.phpfreaks.com/topic/57966-image-display/ Share on other sites More sharing options...
emehrkay Posted July 1, 2007 Share Posted July 1, 2007 http://www.phpfreaks.com/forums/index.php/topic,95426.0.html Link to comment https://forums.phpfreaks.com/topic/57966-image-display/#findComment-287298 Share on other sites More sharing options...
derek barnstorm Posted July 1, 2007 Author Share Posted July 1, 2007 Okay, thanks very much! That works a treat. I gues I should have had a good browse of the forum first. Thanks again, Des. Link to comment https://forums.phpfreaks.com/topic/57966-image-display/#findComment-287319 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.