Log in

View Full Version : Upcoming Events Handler



PawClaw
04-21-2009, 09:18 AM
This is probably something realllllly basic but I can't seem to find a working answer anywhere.

Basically I want to create a box, probably a div, that displays various info based on date and time, to tell users about upcoming events.

So for example:

11am - 3pm GMT on the 21st of april 09 it would display:
"1pm Fishing"

But then 3pm - 1am it'd display:
4pm darts

etc.

So essentially I need a script that either tells the div what content to display at the specified time or a script that tells a series of div's to hide/display according to time.

Anyone got any ideas?

forum_amnesiac
04-21-2009, 12:43 PM
Can you explain a bit more what you want.

Do you want in effect to have an event calendar?

Are you wanting the user to input a date and hour span and then display any event during that period?

Is it real time, ie always today, so display upcoming events for a number of hours from now?

Where do you intend storing the events?

PawClaw
04-21-2009, 01:00 PM
I don't want anything with user interaction, but it is a calendar of sorts.

Essentially I want the output to be:

Upcoming Event:
Fishing 3pm GMT 21/04/2009

It doesn't matter so much what the event is or how it is stored. Ideally it'd be something simply such as a txt file or html document but I could set up a database or anything tht is required.

The goal is to have a dynamic text area which will display the next event based on time and date.

So if the data it was reading had:
20/04/2009 3pm GMT Darts...
21/04/2009 3pm GMT Fishing...
21/04/2009 5pm GMT Poker...

Where all data was in the form of (or similar i dunno what it'd need to work):
Date Time TextStringToReturn

The dynamic area would determine the current date and time and then choose the next chronological event to display.

So the returns for:
20/04/2009 3pm GMT Darts...
21/04/2009 3pm GMT Fishing...
21/04/2009 5pm GMT Poker...

Would be up until 3pm gmt on the 20th april it would display darts...
3pm 20th - 3pm 21st it'd display fishing...
3pm - 5pm 21st it'd display darts...

sxRossi
04-21-2009, 01:25 PM
Hi,

and whats about a page refresh via <meta http-equiv="refresh" each 15 min or so ?
All the script must do is to select events for the rest of the day or week
or whatever

PawClaw
04-21-2009, 01:30 PM
Yes a page refresh would ensure the display was always up to date but that is not what I am after. I need the actual coding to make it pick the right event data to display in the first place.

sxRossi
04-21-2009, 01:50 PM
Ok, i only use databases to store such things and in sql the query would sound
like select subject, eventtime from event where eventtime > now() and day(eventtime) = today order by eventtime

the query would return the next events. The rest is to output the data...

forum_amnesiac
04-21-2009, 01:59 PM
A possible way to handle this, crudely, would be to use the page refresh option with PHP & MYSQL.

You could create a MYSQL table, easy for maintaining events.

You could do a query based on the current date & time using less than or equal to as the operand.

You can get a count of the number of records returned and display the last record.

There may well be a more sophisticated way of doing this but if you want it simple this should work.