views:

44

answers:

1

hi im new to programming i have this small system for room reservations (school requirement). i have this question that is it possible to update the fields of my table on specific date?

i have three tables naming users , reservations, and rooms. i want to update the field of the rooms on specific date, like if the date_out in the rooms table is the same as the sysdate it will update the status field from unavailable to available and make the room available again for choosing.

also can this be able to do with function onLoad ?

looking forward for your answers, thanks !

-renz

+1  A: 

Would probably be easier to rethink how you do it. I had a similar problem that I tackled the following way:

1) Hold reservations in a table. In each row, have a reservation start time and reservation end time. Record each and every reservation as a separate field. No need to update for change in status, just record another entry when room will be in use.

2) To find availability, query the reservation table with all the relevant parameters (room, etc) where current time is greater than start and less than end. If your result count is >=1, then the room is not available.

If you built this as a proper function, you could easily call the function each time your page loads.

bpeterson76