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
https://forums.phpfreaks.com/topic/82288-solved-help-photo-gallery/
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>";
?>

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.