Changeset 775 for trunk/admin


Ignore:
Timestamp:
Apr 26, 2005, 10:47:16 PM (20 years ago)
Author:
plg
Message:
  • DATE() is available only since MySQL 4.1.1, replaced by DAYOFMONTH()
  • array_fill function available only with PHP >= 4.2.0, replaced by a for loop
Location:
trunk/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/images/monthly_stats.img.php

    r766 r775  
    3737$imageHeight = 256;
    3838$imageWidth = 512;
    39 $sql = "SELECT DISTINCT COUNT(*), DAY(date)
    40   FROM ".HISTORY_TABLE."
    41   WHERE (YEAR(date) = ".$_GET['year']." AND MONTH(date) = ".$_GET['month']." )
    42   GROUP BY DATE_FORMAT(date,'%Y-%m-%d') DESC;";
     39$sql = '
     40SELECT DISTINCT COUNT(*)
     41     , DAYOFMONTH(date)
     42  FROM '.HISTORY_TABLE.'
     43  WHERE YEAR(date) = '.$_GET['year'].'
     44    AND MONTH(date) = '.$_GET['month'].'
     45  GROUP BY DATE_FORMAT(date, \'%Y-%m-%d\') DESC
     46;';
    4347
    4448//------------------------------------------------ Image definition
     
    7680or die(mysql_errno().": ".mysql_error()."<BR>".$sql);
    7781
    78 $days =array_fill(1,31,0);
     82$days = array();
     83for ($i = 1; $i <= 31; $i++)
     84{
     85  $days[$i] = 0;
     86}
     87
    7988while ($r = mysql_fetch_row($result))
    8089{
    81   $days [$r[1]]= $r[0];
     90  $days[$r[1]]= $r[0];
    8291}
    8392$o=0;
  • trunk/admin/stats.php

    r766 r775  
    6666$query = '
    6767SELECT DISTINCT COUNT(*) as p,
    68        DATE(date) as d,
     68       DAYOFMONTH(date) as d,
    6969       MONTH(date) as m,
    7070       YEAR(date) as y
Note: See TracChangeset for help on using the changeset viewer.