On 05-Jun-01 Hasan Niyaz wrote:
> Hi,
> 
> I have a room inventory. Clients can block rooms them but I want to
> release them after a specified time if they do not release them
> normally via the given link. I want to be able to trigger an event to
> release the rooms after the time limit.
> Is there any way I can do this with MySQL or PHP.
> 

function expire($limit='12 hour') {
  $qry="UPDATE room_tbl set resvered='no'
    WHERE reserved='yes' AND 
    res_end < DATE_SUB(NOW(), INTERVAL $limit)";

   mysql_query($qry);
}

Call this function at some useful interval, maybe like just before
you check for available rooms.

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to