socox Posted April 17, 2010 Share Posted April 17, 2010 Hi all, I'am learning PHP and I need help with my gallery. I use shadowbox and thats working but I would like create multiple gallerys depending on name in DB, here is code which I use for taking first photo/video as "title" image for gallery: <?php $getpic=mysql_query("Select * from galerija"); $posjeceno[0]=''; while($row=mysql_fetch_assoc($getpic)){ $naslov=$row['naslov']; $slika=$row['slika']; $video=$row['video']; $videoslika=$row['videoslika']; if (!in_array($naslov, $posjeceno)){ $koliko=count($posjeceno); $posjeceno[$koliko]=$naslov; $u_nizu_je=TRUE; if($slika=="") echo " <div class='frameGalerija'> <a href='gallery_video.php'> <img src='".$row['videoslika']."' width='150' height='131' border='0' class='galerijaSlika' alt='Alumni event' /> </a> <div class='galerijaTxt'><a class='galerijaTxt' href='gallery_video.php' > <strong>".$row['naslov']."</strong></a> </div> </div> "; else echo" <div class='frameGalerija'> <a href='gallery_slike.php'> <img src='".$row['slika']."' width='150' height='131' border='0' class='galerijaSlika' alt='Alumni event' /></a> <div class='galerijaTxt'><a class='galerijaTxt' href='gallery_slike.php'> <strong>".$row['naslov']."</strong></a> </div> </div> "; } } ?> So when i click on image(which is link now) I would like that shows only images with same "rel": <?php $getpic=mysql_query("Select * from galerija where naslov='faci'"); while($row=mysql_fetch_assoc($getpic)){ $naslov=$row['naslov']; $slika=$row['slika']; $video=$row['video']; $videoslika=$row['videoslika']; if($slika!="") echo " <a class='prikaz' style='display:block;float:left;' rel='shadowbox[".$row['naslov']."];' href='".$row['slika']."'><img class='slikegalerija' width='150px' height='150px' class='thumbnails' src='".$row['slika']."' alt='' title='".$row['naslov']."'/></a> "; else echo" <!--##this was for video but i dont need it now--> "; } ?> I hope you understand what I mean...or is there bettery way to do this(probably there is) thy for help and time Link to comment https://forums.phpfreaks.com/topic/198862-help-with-gallery/ Share on other sites More sharing options...
litebearer Posted April 17, 2010 Share Posted April 17, 2010 Presuming you want the inital page(s) to have one pic per name and to link a pic to the name's gallery... PSUED0 CODE page one queries the data base using DISTINCT and displays the resulting data as links to page 2 page 2 GETS the name and queries the database for all images for that name and displays accordingly Link to comment https://forums.phpfreaks.com/topic/198862-help-with-gallery/#findComment-1043859 Share on other sites More sharing options...
socox Posted April 17, 2010 Author Share Posted April 17, 2010 yes...but dont know how to do it Link to comment https://forums.phpfreaks.com/topic/198862-help-with-gallery/#findComment-1043875 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.