fix diagram data query
This commit is contained in:
parent
efe17de00c
commit
df739247a1
1 changed files with 5 additions and 5 deletions
10
index.php
10
index.php
|
@ -79,21 +79,21 @@ function get_stats(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$res = $mysqli->query("select hour(date) as h, day(date) as d, count(date) as c from items group by h, d order by d, h");
|
$res = $mysqli->query("select hour(date) as h, day(date) as d, count(date) as c from found_items group by h, d order by d, h");
|
||||||
$ret["graph"] = array();
|
$ret["graph"] = array();
|
||||||
while ($row = $res->fetch_assoc()) {
|
while ($res && $row = $res->fetch_assoc()) {
|
||||||
$ret["graph"][] = $row;
|
$ret["graph"][] = $row;
|
||||||
}
|
}
|
||||||
$res = $mysqli->query("SELECT COUNT(*) AS c FROM lost_items WHERE lost_items.del = 0 ORDER BY id ASC");
|
$res = $mysqli->query("SELECT COUNT(*) AS c FROM lost_items WHERE lost_items.del = 0 ORDER BY id ASC");
|
||||||
if ($row = $res->fetch_assoc()) {
|
if ($res && $row = $res->fetch_assoc()) {
|
||||||
$ret["lost"] = $row["c"];
|
$ret["lost"] = $row["c"];
|
||||||
}
|
}
|
||||||
$res = $mysqli->query("SELECT COUNT(*) AS c FROM found_items WHERE found_items.del = 0 ORDER BY id ASC");
|
$res = $mysqli->query("SELECT COUNT(*) AS c FROM found_items WHERE found_items.del = 0 ORDER BY id ASC");
|
||||||
if ($row = $res->fetch_assoc()) {
|
if ($res && $row = $res->fetch_assoc()) {
|
||||||
$ret["found"] = $row["c"];
|
$ret["found"] = $row["c"];
|
||||||
}
|
}
|
||||||
$res = $mysqli->query("SELECT COUNT(*) AS c FROM matches ORDER BY id ASC");
|
$res = $mysqli->query("SELECT COUNT(*) AS c FROM matches ORDER BY id ASC");
|
||||||
if ($row = $res->fetch_assoc()) {
|
if ($res && $row = $res->fetch_assoc()) {
|
||||||
$ret["match"] = $row["c"];
|
$ret["match"] = $row["c"];
|
||||||
}
|
}
|
||||||
$ret["unmatched"] = $ret["found"] + $ret["lost"] - 2 * $ret["match"];
|
$ret["unmatched"] = $ret["found"] + $ret["lost"] - 2 * $ret["match"];
|
||||||
|
|
Loading…
Reference in a new issue