Hello AD, Wont this query be slow? Lets say that i have first valid image at index 1 and the next one at the index 1000. How would this query perform?
Thanks. On 1/27/08, AD7six <[EMAIL PROTECTED]> wrote: > > > > > On Jan 26, 8:33 pm, "Novice Programmer" <[EMAIL PROTECTED]> > 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. > > Why don't you add a status field on your image table and set it to > true if the image is valid when you add it? Then just look in the db > for the next/previous valid image. Incidentally that's just pagination > with a "show" of 1. > > AD > > > -- Thanks & Regards, Novice (http://ishuonweb.wordpress.com/). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
