aboutsummaryrefslogtreecommitdiffstats
path: root/admin/images
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2005-04-26 20:47:16 +0000
committerplegall <plg@piwigo.org>2005-04-26 20:47:16 +0000
commita32a5a7d36d08a7efb4f6242c1acbd95545e9416 (patch)
tree81f630b165fa19d0d0f3476dedd449d305527550 /admin/images
parent3fc8c9824f1e57e1ef32c7fbfcbf7b1ecd7bcb66 (diff)
- 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 git-svn-id: http://piwigo.org/svn/trunk@775 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/images')
-rw-r--r--admin/images/monthly_stats.img.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/admin/images/monthly_stats.img.php b/admin/images/monthly_stats.img.php
index 9d4d9143d..9720d2a2a 100644
--- a/admin/images/monthly_stats.img.php
+++ b/admin/images/monthly_stats.img.php
@@ -36,10 +36,14 @@ $outputFormat = "png";
$legend = $lang['stats_global_graph_title'];
$imageHeight = 256;
$imageWidth = 512;
-$sql = "SELECT DISTINCT COUNT(*), DAY(date)
- FROM ".HISTORY_TABLE."
- WHERE (YEAR(date) = ".$_GET['year']." AND MONTH(date) = ".$_GET['month']." )
- GROUP BY DATE_FORMAT(date,'%Y-%m-%d') DESC;";
+$sql = '
+SELECT DISTINCT COUNT(*)
+ , DAYOFMONTH(date)
+ FROM '.HISTORY_TABLE.'
+ WHERE YEAR(date) = '.$_GET['year'].'
+ AND MONTH(date) = '.$_GET['month'].'
+ GROUP BY DATE_FORMAT(date, \'%Y-%m-%d\') DESC
+;';
//------------------------------------------------ Image definition
$image = ImageCreate($imageWidth, $imageHeight);
@@ -75,10 +79,15 @@ $myBarGraph->SetBarSpacing(5); // The default is 10. This changes the space
$result = pwg_query($sql)
or die(mysql_errno().": ".mysql_error()."<BR>".$sql);
-$days =array_fill(1,31,0);
+$days = array();
+for ($i = 1; $i <= 31; $i++)
+{
+ $days[$i] = 0;
+}
+
while ($r = mysql_fetch_row($result))
{
- $days [$r[1]]= $r[0];
+ $days[$r[1]]= $r[0];
}
$o=0;
while (list ($key,$value) = each($days ))