Page 1 of 1

pls help.....how to?

Posted: Mon Apr 19, 2004 6:40 am
by crazytopu
hi guys,

running into a problem. hope somebody can help.


i want to reserve a book. but dat reservation will be activated only for 15 hours.

So, i gave the call_no from the form and it reserve the book under the member name who supplied that call_no and his ID.

i wrote a script that find out the 15 hours from the time when the reservation made and save that time in the reservation time along with the call_no.


but i am just not sure how to inactivate that reservation after 15 hours?


When i run a php script i know i can check the column value and i can easily make the reservation inactivated.

but in this case when i m not about to run any php script but still wnt to see the reservation gets inactivated after the stipulated time, i aint got a clue how to do this.


can anybody give me any tips, idea?

shoudl i use any mysql specific funciton?

pls help

Posted: Mon Apr 19, 2004 7:01 am
by magicrobotmonkey
All you need to do is everytime some one uses the script, check for inactive reservations and remove them. Leave the end time there and check it. Just make sure you do it the first thing - I.E. on the log in page at the top. This will ensure that it is *like* the reservations are removed at the appropriate time, because the user will never be able to know that there is an active expired reservation there. Also, you might want to do it on every page as well, in case one expires while the user is there.

Posted: Mon Apr 19, 2004 8:56 am
by liljester
you could write a script that only checks for reservation times, and invalidates expired reservations, then set up a scheduled task (windows) or a cron job (linux/unix) to run the script every 5 minutes or so, however, magicrobotmonkey's suggestion would prolly work just as well =)

Posted: Mon Apr 19, 2004 9:05 am
by magicrobotmonkey
actually, i think mine would work better because a cron job every five minutes allows 4:59 of inaccurate data! A combination of the two would also work though.

Posted: Mon Apr 19, 2004 10:20 am
by crazytopu
Thank you all. I think i got the clue.. :)