Jump to content

A possible problem with a photo accepting page - coming from MYSQL db.


jordz

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.