Events By Day / Date

Hi all,

Sorry to clog up your forum with silly questions - I am an absolute beginner.

I’m basically trying to create a listings ‘website’ that will also go to print. I have collected the info from each venue’s website and treated the data until it’s all in the same format and collated together into one table. Now for the php!

I want to turn:

EVENT NAME ------- DATE
example event A 01/01/2012
example event B 02/01/2012
example event C 02/01/2012
example event D 02/01/2012
example event E 03/01/2012
example event F 03/01/2012

into this:

1st January

example event A

2nd January

example event B
example event C
example event D

3rd January

example event E
example event F

I realise that this is quite a macrocosmic question, but I guess the start of my question is regarding the underlying logic for separating the events out like this?

Any help is greatly appreciated!!

Thank you - Loki :slight_smile:

Maybe like this?

January 1

search database for anything = to january 1
echo it here

january 2

search database for anything = to january 2
echo it here

etc.

Hi Brentb, thanks for your help.

So I’ll ask 366 questions? And have some kind of IF statement so as not to display the date header at all if the results are zero?

Loki

There may or may not be date functions that make this easier however I am not familiar with most date functions… so you may want to look into that…

You should be able to set up a date type variable like this:

Make array with all dates in it

Repeater for 365 {

search database for datearray[0]
if it finds it…
echo datearray[0]; //spits it out as header
echo the database search results;

then add +1 to datearray }


I think that is what you are looking for…

That’s really helpful thank you, I’ll get reading and get to work!

:smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service