Setting a different start and end date to a year....
Posted 29 September 2006 - 08:18 PM
Im working on a soccer site and I want php to dynamically produce the current year as part of a URL variable when they look at data from a specific season. Easy enough right:
The problem is, because a soccer season lies over two years, when 2007 rolls around and the season variable will equal 2007, the mysql query would try to get data from the 2007 season, which isnt there yet.
I would need a small php function which would for example tell 2006 to run from Aug. 2006 to July 2007 as opposed to Jan.2006 to Dec.2006, so that when the $thisyear variable stays at 2006 until July 2007 when it would change over to 2007.....
I know I maybe be confusing to read (php beginner) but if someone understands what I mean, I would appreciate any help or advice...
Posted 29 September 2006 - 08:24 PM
<?php $eight_mon_ago=strtotime("-8 months"); date("Y", $eight_mon_ago); ?>
Basicly get's the year of 8 months ago.
(Gone until 20 to November)
Posted 29 September 2006 - 10:21 PM
Thanks for the response...
Using your below code I now have
echo("<li><a href=\"leaguehome.html?group=1&season=$newseason\">English Premiership</a></li>
However, the $newseason variable returns wild numbers like 1167347827, etc. Any ideas why?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users