Hi I have a weekly shedule that I have put into a table using a mysql database, I need a way of producing the event for the given day and time that I visit my shedule, so say I visit my online shedule on tuesday @ 15:45 I need it to produce the events for the 2 hour window on the given day e.g. 14:00 - 15:59.
So basically I need it to select a certain row in a table at the current time and day.
so here is how my shedule is setup
Days Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday
Times
08:00 - 09:59
10:00 - 11:59
12:00 - 13:59
14:00 - 15:59
16:00 - 17:59
18:00 - 19:59
20:00 - 21:59
22:00 - 23:59
00:00 - 07:59
Not asking for a complete script here just some pointers in the right direction.
Regards, Dom.
php shedule help
Moderator: General Moderators
Re: php shedule help
Simply identify each event with its starting and ending timestamp, using a default unix timestamp (seconds since 1970). You can then do to select the row for the current time (with $curTime being the current time).
As long as you're working with 2 hour windows, you can use endTime = startTime+2*60*60 when creating new rows/events.
See also date and mktime.
Code: Select all
SELECT * FROM table WHERE startTime<=$curTime AND endTime>$curTimeAs long as you're working with 2 hour windows, you can use endTime = startTime+2*60*60 when creating new rows/events.
See also date and mktime.