add left join
This commit is contained in:
parent
aaff9d65be
commit
fecc2fffcd
3 changed files with 24 additions and 25 deletions
|
@ -22,7 +22,7 @@ function auth(){
|
|||
|
||||
function get_founditems(){
|
||||
global $mysqli;
|
||||
$res = $mysqli->query("SELECT * FROM items ORDER BY id ASC");
|
||||
$res = $mysqli->query("SELECT * FROM items LEFT JOIN matches ON items.id = matches.f_id WHERE matches.f_id IS NULL ORDER BY id ASC");
|
||||
$ret = array();
|
||||
while ($row = $res->fetch_assoc()) {
|
||||
$ret[] = $row;
|
||||
|
@ -32,7 +32,7 @@ function get_founditems(){
|
|||
|
||||
function get_lostitems(){
|
||||
global $mysqli;
|
||||
$res = $mysqli->query("SELECT * FROM lost ORDER BY id ASC");
|
||||
$res = $mysqli->query("SELECT * FROM lost LEFT JOIN matches ON lost.id = matches.l_id WHERE matches.l_id IS NULL ORDER BY id ASC");
|
||||
$ret = array();
|
||||
while ($row = $res->fetch_assoc()) {
|
||||
$ret[] = $row;
|
||||
|
@ -68,6 +68,7 @@ function get_stats(){
|
|||
if ($row = $res->fetch_assoc()) {
|
||||
$ret["match"] = $row["c"];
|
||||
}
|
||||
$ret["unmatched"] = $ret["found"] + $ret["lost"] - (2 * $ret["match"]);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
|
||||
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- Breadcrumbs-->
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="index.html">Dashboard</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">404 Error</li>
|
||||
</ol>
|
||||
|
||||
<!-- Page Content -->
|
||||
<h1 class="display-1">404</h1>
|
||||
<p class="lead">Page not found. You can
|
||||
<a href="javascript:history.back()">go back</a>
|
||||
to the previous page, or
|
||||
<a href="index.html">return home</a>.</p>
|
||||
|
||||
</div>
|
||||
<!-- /.container-fluid -->
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- Breadcrumbs-->
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="index.html">Dashboard</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">404 Error</li>
|
||||
</ol>
|
||||
|
||||
<!-- Page Content -->
|
||||
<h1 class="display-1">404</h1>
|
||||
<p class="lead">Page not found. You can
|
||||
<a href="javascript:history.back()">go back</a>
|
||||
to the previous page, or
|
||||
<a href="index.html">return home</a>.</p>
|
||||
|
||||
</div>
|
||||
<!-- /.container-fluid -->
|
||||
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ $stats = get_stats();
|
|||
<div class="card-body-icon">
|
||||
<i class="fas fa-fw fa-comments"></i>
|
||||
</div>
|
||||
<div class="mr-5"><?php echo $stats["lost"]+$stats["found"]-2*$stats["matched"]; ?> Unmatched Items</div>
|
||||
<div class="mr-5"><?php echo $stats["unmatched"]; ?> Unmatched Items</div>
|
||||
</div>
|
||||
<a class="card-footer text-white clearfix small z-1" href="/?page=tinder">
|
||||
<span class="float-left">View Details</span>
|
||||
|
|
Loading…
Reference in a new issue