Skip to main content
Participant
September 29, 2006
Question

Execute Query before Session Ends

  • September 29, 2006
  • 1 reply
  • 212 views
Hello,
I am working on an applicationt that is basically a virtual lineup to book appointments. Basically, users log in and are presented with the next available time slot from the database. They can either confirm the time or log out. When they confirm the time, the time is then marked as "taken" in the database..

"times table"
slot_id
date
time
taken (bit)
offered (bit)

I realized yesterday that if Person A logged in and was offered time_slot = 1, then if person B logged in before person A finished registering (confirm) then Person B would also be offered time_slot = 1. To overcome this, I created the "offered" field. Basically, as soon as a time is offered, the "offered" field turns from 0 to 1. So now, when Person A logs in, the time they are offered is set to "1" and when person B logs in, they are given the next available time that is not "offered" or "taken".

I hope you are following.

What I am having trouble doing now is the following...
If person A logs in, is offered a time_slot and that time_slot becomes marked "offered"...when they logout or close the window the time_slot remains marked as "offered" i.e. "offered = 1". I am trying to figure out a way to automatically change the specific time_slot's "offered" field back to 0 in the case that it is not confirmed. Does this make any sense?
Please help,
Thank you.
This topic has been closed for replies.

1 reply

Participating Frequently
September 30, 2006
If you are using CF7, you can use Application.cfc and specify the necessary code in the onSessoinEnd method.