Hello,

I often use solution 1. I think this solution can be applied in almost 
all cases. However I have another solution. How about this:

1. add 2 fields (prev_valid_index and next_valid_index) in table.
2. update these fields in afterSave function.
3. show image with the next/previous link according to the fields.


Best Wishes,

Takuo Shiono

Novice Programmer wrote:
> Though this is less of a database question. but i am still posting it here
> since I think we can discuss the design as well.. :).
> 
> I am maintaining a adresses of images stored on my filesystem in a database.
> I have designed a system to show those images to the user. This interface
> has the next and previous button as well. When user clicks on next he goes
> to the *next valid image*. Note the difference here. I have to show only
> valid images. This means that all the images in the database are not to be
> shown. Lets consider an example. Say that my database consists of following
> images:
> 
> 1. Image1(Valid)
> 2. Image2(InValid)
> 3 Image3(Invalid)
> 4. Image4(Valid)
> 
> so when user is viewing image 1 and clicks on next he goes to image4
> directly even though image2 is stored in the next index on the database. I
> have thought of following solutions but none of them are appealing me:
> 
> 1. Maintain a variable which tells the index of next valid image. Maintain a
> variable which tells me the index of last valid image and when next valid
> image comes, update the index of the last valid image with this new image.
> Similarly maintain the previous variable.
> 2. I am storing time stamp along with the images. On clicking next, I load
> the image having the most recent time stamp after this image. but still I
> dont like this query as this may be slow.
> 
> Please help.
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to