Dynadot โ€” .com Transfer

Mysql/ PHP ..Missing Year.. 2007 , --, 2009 , 2010

Spaceship Spaceship
Watch
Impact
9
I have data archived and on the archive.php page uses can select the year and see all the data for that year .. Everything works fine except one year (2008) displays a white /empty page ..


anyone see anything here that may cause that ? //Begin Session
//Generate Query
$year = $_GET['year'];
$month = $_GET['month'];
$state = $_GET['state'];
$city = $_GET['city'];
//Begin Building Query
$Query.= 'SELECT * FROM `prices` WHERE `archive`=\'1\' ';
//Check if they are not empty
if(empty($year) || !is_numeric($year)){ $year = 'allyears'; }
if($year == 'allyears'){ $year = date('Y'); }
if(empty($month) || !is_numeric($month)){ $month = 'allmonths'; }
if(empty($state)){ $state = 'allstates'; }
if(empty($city)){ $city = 'allcitys'; }
//Generate time code
if($year == 'allyears' && $month == 'allmonths'){
//Do not alter query
} else{
if($month == 'allmonths'){
//Display Whole Year
$min = mktime(0,0,0,1,0,$year);
$max = mktime(24, 0, 0, 12, 31, $year);
} else{
//Convert to time stamps
$min = mktime(0, 0, 0, $month, 0, $year);
$lastday = date('t', mktime(0,0,0,$month,2,$year));
$max = mktime(24, 0, 0, $month, $lastday, $year);
}
$Query.= "AND `timestamp`>'$min' AND `timestamp`<'$max' ";





BTW .. It will Display any selected Month ..for 2008 just not the year

Year works for 2007, 2009 , 2010 ..not 2008
}
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Ummm.. could the mk time be wrong because 2008 was a leap year ? !
 
0
•••
$min = mktime(0,0,0,1,0,$year);

By setting day as 0, I was under the impression it would give the LAST day of the month before?

---------- Post added at 10:48 AM ---------- Previous post was at 10:40 AM ----------

mktime(0,0,0,1,0,2008) - 1199088000
mktime(0,0,0,1,1,2008) - 1199174400
mktime(24,0,0,12,31,2008) - 1230796800

So 1,0 would represent the beginning of the last day of december?
 
0
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
Domain Recover
DomainEasy โ€” Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back