[Devel] r214 - trunk
svn at agendadulibre.org
svn at agendadulibre.org
Dim 14 Jan 19:43:00 CET 2007
Author: thomas
Date: Sun Jan 14 19:42:59 2007
New Revision: 214
Modified:
trunk/stats.php
Log:
Ajout de statistiques par ville.
Modified: trunk/stats.php
==============================================================================
--- trunk/stats.php (original)
+++ trunk/stats.php Sun Jan 14 19:42:59 2007
@@ -74,6 +74,35 @@
echo "</table>";
+echo "<h3>Statistiques par ville</h3>";
+
+$result = $db->query ("select city,count(*) as 'event_count' from events group by city order by event_count desc");
+
+echo "<table class=\"stats\">";
+
+$i = 0;
+while ($row = mysql_fetch_object($result))
+{
+ /* The preselection could have been directly in MySQL, but
+ unfortunately, MySQL 4.0 doesn't support subrequests in the from
+ clause */
+ if ($row->event_count <= 3)
+ break;
+
+ if ($i % 2 == 0)
+ echo "<tr class=\"odd\">";
+ else
+ echo "<tr class=\"even\">";
+
+ echo "<td class=\"item\">" . $row->city . "</td><td class=\"value\">" . $row->event_count . "</td>";
+
+ echo "</tr>";
+
+ $i++;
+}
+
+echo "</table>";
+
echo "<h3>Statistiques par date</h3>";
$result = $db->query ("SELECT CONCAT(YEAR(start_time), '-', MONTH(start_time)) AS 'month',COUNT(*) AS 'event_count' FROM events GROUP BY EXTRACT(YEAR_MONTH FROM start_time)");
Plus d'informations sur la liste de diffusion Devel