jordz Posted March 18, 2010 Share Posted March 18, 2010 Hey All, I've been working on a photography site lately where the scenario is you upload a page, it gets put into a queue then screened, then on to the site itself. I haven't created the screening/accepting page yet, this is where you can accept or reject a photo that is in the queue (if you are a photo screener). The screening photo page itself will selects the first photo (where the id = 0) from the MYSQL database table "photos" and displays the image, it has a field called screen_id which can either be set to 0, 1 or 2. If it's set to 0 its in the queue, 2 is accepted and 3 is rejected However, I've been thinking about this and It could be a possible problem: If more than one person is screening at the same time, theoretically the screeners would end up with same image from one time to another, or more often? I need a way around this as this is a major problem. Any ideas? Screeners are separate users. Here's the simple code. $mysql = "SELECT * FROM photos WHERE screenid='1' ORDER by DESC"; $run = mysql_query($mysql); $photo = mysql_fetch_array($mysql, MYSQL_ASSOC); the screening process takes about 3 mins, so in that time another screener could be on that same image. What are the ways round this? Many Thanks Jordan Quote Link to comment https://forums.phpfreaks.com/topic/195736-a-possible-problem-with-a-photo-accepting-page-coming-from-mysql-db/ Share on other sites More sharing options...
Psycho Posted March 18, 2010 Share Posted March 18, 2010 it has a field called screen_id which can either be set to 0, 1 or 2. If it's set to 0 its in the queue, 2 is accepted and 3 is rejected Huh? You have statuses of 0, 1, 2, but then you state values for 0, 2, & 3??? In any event, you need to create another status to indicate that an image is in the process of being screened. So, when you pull the next image for a screener, you also set it's status so another screener will not get the same image. However, you would also need to account for those instances where a screener does not complete the screening process - otherwise the image would be stuck in limbo. Either a scheduled or manual event to reset all images in the being screened status to the not screened status. You could use statuses such as this: 0: In queue, Not screened 1: In the process of being screened 2: Rejected 3: Accepted But, I would use two different fields: Screened: 0/1 (0 - in queue, 1 being/has been screened) Accepted: 0/1 (0 - rejected, 1 accepted). You could then find images that got stuck in the screening process where Sreened = 1, but the accepted value is null. Quote Link to comment https://forums.phpfreaks.com/topic/195736-a-possible-problem-with-a-photo-accepting-page-coming-from-mysql-db/#findComment-1028290 Share on other sites More sharing options...
jordz Posted March 18, 2010 Author Share Posted March 18, 2010 Yeah, could there be a possible way of creating some kind of time that times out the page if it's been left for over 10 minutes it would set the screen ID to something like in queue? Jordan Quote Link to comment https://forums.phpfreaks.com/topic/195736-a-possible-problem-with-a-photo-accepting-page-coming-from-mysql-db/#findComment-1028322 Share on other sites More sharing options...
jordz Posted March 18, 2010 Author Share Posted March 18, 2010 Yeah, sorry about the first quest I got a bit muddled up, was on the phone and typing at the same time forgive me. That Idea sounds good, but this timer business, any ideas? Jordan Quote Link to comment https://forums.phpfreaks.com/topic/195736-a-possible-problem-with-a-photo-accepting-page-coming-from-mysql-db/#findComment-1028333 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.