phpwannabe25 Posted August 27, 2009 Share Posted August 27, 2009 Hi, Just a question in regards to the lightbox. The site i have draws images relevant to teh users page on to the screen with a SQL statement. The images are kept in the images directory and the image 'address' is stored in a table. so i need to connect to the database in order to get teh image echoed on to the screeen. every lightbox example i ahve seen on the web, simply has the images folder and the image is named in the xHTML. This will not be the case in my situation, the image displyed will be drawn from the sql statement. Will it still be possible to use the lightbox in this case, and if so what is the best way to approach it? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/172139-lightbox/ Share on other sites More sharing options...
MatthewJ Posted August 27, 2009 Share Posted August 27, 2009 Yes... just set up light box using a locally stored image... then change the src of the image to the db field that contains the image link. Link to comment https://forums.phpfreaks.com/topic/172139-lightbox/#findComment-907631 Share on other sites More sharing options...
phpwannabe25 Posted August 27, 2009 Author Share Posted August 27, 2009 Thanks mathewJ. Im still havin a few problems.. ill be more specific. The one i am using and which works is as follows, with no database, just the image directory next to the other folder... <a href="images/26.jpg" rel="lightbox[mando]" id="image1" title="image 1"><img src="images/26.jpg" height="100" width="100" border="0" alt="" /></a> <div class="lightboxDesc image1">My description for image 1</div> then the way i am drawin the image to my page is as follows, (before the lightbox effect) <?php $con = mysql_connect("dbdetails","dbdetails","dbdetaisl"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("dbdetails", $con); //Retrieves data from MySQL $data = mysql_query("SELECT logo FROM signuphotel WHERE signuphotel.username = '$username'") ; //Puts it into an array while($info = mysql_fetch_array( $data )) { //Outputs the image and other data Echo "<tr><td align='center'><img src=http://www.mysite.com/Website/images/".$info['logo'] ." alt='logo' rel='lightbox[mando]' border='1' height='100' width='100'> <br></td></tr>"; } Ths is where i am confuse....???? Link to comment https://forums.phpfreaks.com/topic/172139-lightbox/#findComment-907942 Share on other sites More sharing options...
waynew Posted August 27, 2009 Share Posted August 27, 2009 What's the output of the second example?? Link to comment https://forums.phpfreaks.com/topic/172139-lightbox/#findComment-907975 Share on other sites More sharing options...
phpwannabe25 Posted August 28, 2009 Author Share Posted August 28, 2009 The logo appears on the page...where it should do, but when i click on it, nothign happens, the lightbox effect does not work.... Link to comment https://forums.phpfreaks.com/topic/172139-lightbox/#findComment-908211 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.