You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 19, 2022. It is now read-only.
$sql = "SELECT year, month, sourceIdp, SUM(count) AS count FROM ".$table_name. " GROUP BY year, month, sourceIdp HAVING sourceIdp != ''";
57
-
$result = $conn->query($sql);
60
+
$stmt = $conn->prepare("SELECT year, month, sourceIdp, SUM(count) AS count FROM ".$table_name. " GROUP BY year, month, sourceIdp HAVING sourceIdp != '' ORDER BY year DESC, month DESC, count DESC");
$sql = "SELECT year, month, service, SUM(count) AS count FROM ".$table_name." GROUP BY year, month, service HAVING service != ''";
71
-
$result = $conn->query($sql);
75
+
$stmt = $conn->prepare("SELECT year, month, service, SUM(count) AS count FROM ".$table_name." GROUP BY year DESC, month DESC, service HAVING service != '' ORDER BY year DESC, month DESC, count DESC");
$sql = "SELECT SUM(count) AS count FROM " . $table_name." WHERE year = ".$dateTime->format('Y')." AND month=".$dateTime->format('m')." AND day = ".$dateTime->format('d');
105
-
$result = $conn->query($sql);
111
+
$stmt = $conn->prepare("SELECT SUM(count) AS count FROM " . $table_name." WHERE year = ".$dateTime->format('Y')." AND month=".$dateTime->format('m')." AND day = ".$dateTime->format('d'));
112
+
$stmt->execute();
113
+
$result = $stmt->get_result();
106
114
while ($row = $result->fetch_assoc()) {
107
115
$count = $row["count"];
108
116
}
@@ -121,8 +129,9 @@ public static function getAccessCountPerService()
$sql = "SELECT AVG(count) as avg_count FROM (SELECT year, month, day, SUM(count) AS count FROM " . $table_name . " GROUP BY year,month,day ) AS average_count;";
191
-
$result = $conn->query($sql);
202
+
$stmt = $conn->prepare("SELECT AVG(count) as avg_count FROM (SELECT year, month, day, SUM(count) AS count FROM " . $table_name . " GROUP BY year,month,day ) AS average_count;");
203
+
$stmt->execute();
204
+
$result = $stmt->get_result();
192
205
while($row = $result->fetch_assoc()) {
193
206
$avg_count = $row["avg_count"];
194
207
}
@@ -206,8 +219,9 @@ public static function getMaxLoginCountPerDay()
$sql = "SELECT MAX(count) as max_count FROM (SELECT year, month, day, SUM(count) AS count FROM " . $table_name . " GROUP BY year,month,day ) AS maximal_count;";
210
-
$result = $conn->query($sql);
222
+
$stmt = $conn->prepare("SELECT MAX(count) as max_count FROM (SELECT year, month, day, SUM(count) AS count FROM " . $table_name . " GROUP BY year,month,day ) AS maximal_count;");
0 commit comments