phper100001 Posted March 9, 2009 Share Posted March 9, 2009 I've been trying to make a very simple photo gallery where the user selects a gallery from a drop-down menu and clicks view. The gallery is supposed to load and display 3 rows of 3 images per page as well as a next and previous button. The drop down menu links to a database which contains the directory the images are located in. For some reason my gallery won't stop when all the files in the directory have been displayed. It also only displays 8 images. (2 rows of 3 and 1 of 2). The menu and image handling works but it isn't looping how I intended. To be perfectly honest I don't know alot about PHP programming and this is probably literred with mistakes. $Dir = $_GET['Dir']; $Dir = str_replace(" ", "", $Dir); $Read = opendir($Dir); if (!isset($_GET['photoid'])){ $photoid = "1"; } else { $photoid = $_GET['photoid']; } $imageinrow = 0; ?> <table align="center"> <? //List files in images directory while (($file = readdir($Read)) !== false && $rows < 3) { $imageinrow = 0; echo "<tr>"; while (($file = readdir($Read)) !==false && $imageinrow < 3) { ?> <td width="145" align="center"> <a href="<? echo $Dir; ?>/image<? echo $photoid; ?>.jpg"> <img width="135" src="<? echo $Dir; ?>/image<? echo $photoid; ?>.jpg" /> </a> </td> <? $photoid++; $imageinrow++; } $rows++; echo "</tr>"; } echo "</table>"; closedir($Read); Link to comment https://forums.phpfreaks.com/topic/148665-solved-problems-with-photo-gallery/ Share on other sites More sharing options...
phper100001 Posted March 10, 2009 Author Share Posted March 10, 2009 Figured it all out. Link to comment https://forums.phpfreaks.com/topic/148665-solved-problems-with-photo-gallery/#findComment-780949 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.