for art project trying set order site. concept allows users book max. of 2 time slots each artist. there 12 slots per artist, each slot specific definition (so each unique). slots available limited time , booked fast. there lot of requests in short period of time. have make sure each article/slot offered single user @ time , cannot double booked.
my idea was, check next unbooked slot(s) (status="free) , on request update status of corresponding row in table status="locked". if user proceeds book slot, status updated "booked".
if user clicks "cancel" can release article updating row status="free".
however, not unlikely users abandon site , don't see way check that. slot remain "locked". thinking, there might way automatically reset status e.g. 120 seconds after "locked" , show countdown users. enhance excitement factor.
i don't think cron job work need anchor last update of row , not specific datetime.
i looked mysql events understood cannot manipulate data of table attached to.
i appreciate ideas. thanks, sam
in db status table add
datetime
field.when lock
slot
save current time usingnow()
when consult slots perform , update , free inactive slots
update slots set locked = false `datetime`> now() - interval 15 minute; select * slots locked = false;
Comments
Post a Comment