Jump to content

[SOLVED] Gallery Logic Problem


lokie538

Recommended Posts

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.