ayok Posted December 19, 2007 Share Posted December 19, 2007 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 Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted December 19, 2007 Share Posted December 19, 2007 You missed single quote in $data[descript] and images/$data[image]. That is the one i saw. Quote Link to comment Share on other sites More sharing options...
redarrow Posted December 19, 2007 Share Posted December 19, 2007 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>"; ?> Quote Link to comment Share on other sites More sharing options...
ayok Posted December 19, 2007 Author Share Posted December 19, 2007 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 Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 19, 2007 Share Posted December 19, 2007 just set up a defaul image in the iframe. whats your iframe code? Quote Link to comment Share on other sites More sharing options...
ayok Posted December 19, 2007 Author Share Posted December 19, 2007 Hey thanks, I've got what you mean. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.