lokie538 Posted December 22, 2008 Share Posted December 22, 2008 Hi, Im making a gallery part too a site im working on where users can update their own pictures onto the site. Im not sure how to go about one problem. At the moment when a picture is uploaded, there is a query which finds the max(picid) stored in a images database. Pictures are stored in a database, their id, title and a new other things are stored. In the gallery i have the code for the next and previous picture button as such: <?php $nextpic = ($picid + 1); $prevpic = ($picid - 1); if ($row['min(picid)'] == $picid) { $prevpic = $row['max(picid)']; }; if ($row['max(picid)'] == $picid) { $nextpic = $row['min(picid)']; }; ?> So this whole system is working fine atm, the problem now is that I want to allow for deleted photos. I was thinking something like when a picture is deleted, leave the picid the same and change the title to "deleted", and then on the next and previous buttons make it skip, pictures with picid. Im not totally sure on the code I would use to do this atm tho. Is this a good way to solve my problem or do i somehow delete the whole entry out of the table and for the next and previous buttons, check if the next picid actually exists? and then when a new picture is uploaded it can take its spot? yea im not sure which way would be the best way to go? Any thoughts guys? Quote Link to comment Share on other sites More sharing options...
sloth456 Posted December 22, 2008 Share Posted December 22, 2008 I think the least resource intensive is just to have the script check if the id actually exists and if not go one back/further. 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.