Jump to content

Archived

This topic is now archived and is closed to further replies.

johnska7

Need help with mysql loop into PHP

Recommended Posts

I'm trying to get a loop going from my mysql database, but I'm running into some logic problems. I think I just need to be shown the road.

What I'm trying to do is display a certain amount of dates, between june 1st of one year and june 1st of the next year, like this:

[img src=\"http://www.sbschools.org/images/chart.gif\" border=\"0\" alt=\"IPB Image\" /]

my database looks like this:

[img src=\"http://www.sbschools.org/images/db.gif\" border=\"0\" alt=\"IPB Image\" /]

So pretty much what I need to do is:

find out what's in the database and sort it into groups of years. For each of the dates returned, I have to find out if it should go into $date[0]-1."-06-01" or $date[0]+1."-06-01" so I can get the listing like in the first picture. Can anyone help me start on this path?

PS - Please ignore the first pictures dates being inconsistent...I just copy and pasted into photoshop

Share this post


Link to post
Share on other sites
try
SELECT * FROM table WHERE start_date <= THIS YEAR AND start_date >= LAST YEAR ....

Share this post


Link to post
Share on other sites
So your year goes from june 1st to May 31st

Ray

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.