Jump to content

[SOLVED] Help Photo Gallery


ayok

Recommended Posts

Hi, I need help for my simple photo gallery.

 

I have 3 php file for my photo gallery. In index.php I use 2 iframes, one for thumbs.php (thumbnails) and one is for displaying the bigger picture (image.php). The picture is displayed when we clicked on one of the thumbnail.

 

The problem is when I open my photo gallery, the default picture on iframe image (image.php) is blank. This is my image.php:

<?php
include "../connection/db.php";

$result = mysql_query("SELECT * FROM gallery WHERE pic_id='$id'") or DIE(mysql_error());
echo "<TABLE bgcolor=#EBC0A0 border=0 cellpadding=5 cellspacing=5 align=center>";
while ($data=mysql_fetch_array($result))
{
echo "<TR>";
echo "<td align='right'>$data[descript]</td></tr>";
echo "<tr><TD><img src='images/$data[image]'></a></TD></tr>";
}
echo "</table>";
?>

I know that I need to make an if statement, but after several tries, I gave up. Could someone help me out here? Any help will be appriciated. ;)

 

Thank you,

ayok

Link to comment
Share on other sites

 

Trie this please.....

<?php
include "../connection/db.php";

$result = mysql_query("SELECT * FROM gallery WHERE pic_id='$id'") or DIE(mysql_error());
echo "<TABLE bgcolor=#EBC0A0 border=0 cellpadding=5 cellspacing=5 align=center>";
while ($data=mysql_fetch_array($result))
{
echo "<TR>";
echo "<td align='right'>".$data['descript']."</td></tr>";
echo "<tr><TD><img src='images/".$data['image']."'></a></TD></tr>";
}
echo "</table>";
?>

Link to comment
Share on other sites

Thanks for the reply, guys.

The script is ok. It works properly. The picture shows up everytime I clicked on one of the thumbnail.

 

My problem is, everytime I open the gallery, there is no displayed picture (because I haven't click on a thumbnail). The default image is blank. What I want to do is to display the last picture for the default (when I haven't clicked on any thumbnail). I hope it's clear.

 

Thank you,

ayok

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.