Jump to content

Image Display


Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.