minor improvements
This commit is contained in:
parent
be8b5f50f2
commit
9962aff322
10 changed files with 217 additions and 561 deletions
31
index.php
31
index.php
|
@ -40,6 +40,37 @@ function get_lostitems(){
|
|||
return $ret;
|
||||
}
|
||||
|
||||
function get_matches(){
|
||||
global $mysqli;
|
||||
$res = $mysqli->query("SELECT matches.id AS id, matches.f_id as f_id, matches.l_id as l_id, lost.was as l_desc, items.was as f_desc "
|
||||
."FROM lost, items, matches WHERE lost.id = matches.l_id and items.id = matches.f_id ORDER BY matches.id ASC;");
|
||||
$ret = array();
|
||||
while ($row = $res->fetch_assoc()) {
|
||||
$ret[] = $row;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function get_stats(){
|
||||
global $mysqli;
|
||||
$ret = array();
|
||||
$ret["lost"]=0;
|
||||
$ret["found"]=0;
|
||||
$res = $mysqli->query("SELECT COUNT(*) AS c FROM lost ORDER BY id ASC");
|
||||
if ($row = $res->fetch_assoc()) {
|
||||
$ret["lost"] = $row["c"];
|
||||
}
|
||||
$res = $mysqli->query("SELECT COUNT(*) AS c FROM items ORDER BY id ASC");
|
||||
if ($row = $res->fetch_assoc()) {
|
||||
$ret["found"] = $row["c"];
|
||||
}
|
||||
$res = $mysqli->query("SELECT COUNT(*) AS c FROM matches ORDER BY id ASC");
|
||||
if ($row = $res->fetch_assoc()) {
|
||||
$ret["match"] = $row["c"];
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$page = isset($_GET["page"])?$_GET["page"]:"dashboard";
|
||||
|
||||
if (!auth()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue