PDA

View Full Version : Grouping data with tables an a bit of ajax


jaymo
04-02-2009, 09:43 PM
I have a table outputting events from a database, each with its own date. Eg

Event 1 | 01/05/2009
Event 2 | 03/05/2009

This is working fine but I will have loads of events so i want to organise them into days. I want to display Monday to Sunday as links and let the user click them. The result should be only events on say monday. I'm thinking do something with the current date an then run a query for each day link to see if there are matches. I cant get my head around at the moment.

Btw I am using ajax to call the php file that does the table output. I want the links to be on the plain ajax page an then some variable to the php and return the correct data. I can do all that but i just dont know what to send :S

Thanks,
James

davidj
04-02-2009, 09:51 PM
you need some kind of calendar function

can you do a visual mockup of how you want it to work

jaymo
04-02-2009, 11:05 PM
Thanks for the reply David. I always get a bit lost when doing validation forms like this. I see a lot of sites with good forms that have hyperlinks and then sub links when clicked.

Im assuming you mean finding out the number of days in the month and things like that? I was thinking query the entire table, find the dates that fall on monday of that month and group them etc. That make sense?

Anyway here's the mockup:

Day hyperlinks:
-------------
Days |
-------------
Monday |
Tuesday |
Wednesday |
etc... |
-------------

Output Div:
------------------------------
Event details | Date |
------------------------------
blah blah 10/12/20009 |
------------------------------


Cheers

davidj
04-03-2009, 06:30 AM
will code up an example over the weekend

jaymo
04-03-2009, 01:39 PM
That would be brilliant, thanks mate :)