phpwannabe25 Posted September 1, 2009 Share Posted September 1, 2009 Hi, I am calling photos from my database, which is no problem.... the code for which is below: <div id="hotelphotos"> <?php $hotelident = $_GET["id"]; $con = mysql_connect("dbdetails","dbdetails","db details"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("db details", $con); $result = mysql_query("SELECT * FROM signuphotel WHERE id = '$hotelident' "); while($row = mysql_fetch_array($result)) { Echo "<tr><td align='center'><img src=http://www.mywebsite.com/images/".$row['photo2'] ." alt='photo2' border='1' height='160' width='171'></td><tr>"; } mysql_close($con); ?> </div> This is working fine! Now, im attempting to introduce a light box effect in to the page. I've added the lightbox.js and the mootools.js scrtips and putt the path to the head. The code i've used for the photos has now changed to the following: The result is nothing, just a blank screen....clearly i am goin majoryly wrong somewhere, however could anyone point me in the right direction in gettin from the code above to havin the lightbox ipmlemented in conjunction with the database fed photos. <div id="hotelphotos"> <?php $hotelident = $_GET["id"]; $con = mysql_connect("dbdetails","dbdetails","dbdetails"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("db details", $con); $result = mysql_query("SELECT * FROM signuphotel WHERE id = '$hotelident' "); while($row = mysql_fetch_array($result)) { Echo "<tr><td align='center'><a href=".$row['photo1'] ." rel="lightbox[mando]" id="image1" title="image 1">"<img src=http://www.mywebsite/images/".$row['photo1'] ." alt='photo1' border='1' height='160' width='171' /></a></td><tr>"; echo "<tr><td> </td></tr>"; } mysql_close($con); ?> <script type="text/javascript"> window.addEvent('domready',function(){ Lightbox.init({descriptions: '.lightboxDesc', showControls: true}); }); </script> </div> Link to comment https://forums.phpfreaks.com/topic/172708-lightbox-problem/ Share on other sites More sharing options...
ignace Posted September 1, 2009 Share Posted September 1, 2009 Echo "<tr><td align='center'><a href=".$row['photo1'] ." rel=\"lightbox[mando]\" id=\"image1\" title=\"image 1\"><img src=http://www.mywebsite/images/".$row['photo1'] ." alt='photo1' border='1' height='160' width='171' /></a></td><tr>"; Link to comment https://forums.phpfreaks.com/topic/172708-lightbox-problem/#findComment-910345 Share on other sites More sharing options...
phpwannabe25 Posted September 1, 2009 Author Share Posted September 1, 2009 Thank You Ignace, This helped a lot, now the result of the photo appears on the page, the cursor turns to a hand when placed over the photo, however when clicked on returns an error..... Link to comment https://forums.phpfreaks.com/topic/172708-lightbox-problem/#findComment-910348 Share on other sites More sharing options...
ignace Posted September 1, 2009 Share Posted September 1, 2009 Echo "<tr><td align='center'><a href=\"http://www.mywebsite/images/".$row['photo1'] ."\" rel=\"lightbox[mando]\" id=\"image1\" title=\"image 1\"><img src=\"http://www.mywebsite/images/".$row['photo1'] ."\" alt='photo1' border='1' height='160' width='171' /></a></td><tr>"; Link to comment https://forums.phpfreaks.com/topic/172708-lightbox-problem/#findComment-910368 Share on other sites More sharing options...
phpwannabe25 Posted September 2, 2009 Author Share Posted September 2, 2009 Thanks very much ignace That works perfectly now! Link to comment https://forums.phpfreaks.com/topic/172708-lightbox-problem/#findComment-910855 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.