removed matched items from item lists
This commit is contained in:
parent
aaff9d65be
commit
8881ab8041
3 changed files with 14 additions and 6 deletions
12
index.php
12
index.php
|
@ -20,9 +20,13 @@ function auth(){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_founditems(){
|
function get_founditems($onlyUnmatched = false){
|
||||||
global $mysqli;
|
global $mysqli;
|
||||||
|
if ($onlyUnmatched) {
|
||||||
|
$res = $mysqli->query("SELECT items.* FROM items LEFT JOIN matches ON items.id = matches.l_id WHERE matches.l_id IS NOT NULL ORDER BY items.id ASC");
|
||||||
|
} else {
|
||||||
$res = $mysqli->query("SELECT * FROM items ORDER BY id ASC");
|
$res = $mysqli->query("SELECT * FROM items ORDER BY id ASC");
|
||||||
|
}
|
||||||
$ret = array();
|
$ret = array();
|
||||||
while ($row = $res->fetch_assoc()) {
|
while ($row = $res->fetch_assoc()) {
|
||||||
$ret[] = $row;
|
$ret[] = $row;
|
||||||
|
@ -30,9 +34,13 @@ function get_founditems(){
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_lostitems(){
|
function get_lostitems($onlyUnmatched = false){
|
||||||
global $mysqli;
|
global $mysqli;
|
||||||
|
if ($onlyUnmatched) {
|
||||||
|
$res = $mysqli->query("SELECT lost.* FROM lost LEFT JOIN matches ON lost.id = matches.f_id WHERE matches.f_id IS NOT NULL ORDER BY lost.id ASC");
|
||||||
|
} else {
|
||||||
$res = $mysqli->query("SELECT * FROM lost ORDER BY id ASC");
|
$res = $mysqli->query("SELECT * FROM lost ORDER BY id ASC");
|
||||||
|
}
|
||||||
$ret = array();
|
$ret = array();
|
||||||
while ($row = $res->fetch_assoc()) {
|
while ($row = $res->fetch_assoc()) {
|
||||||
$ret[] = $row;
|
$ret[] = $row;
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
</tfoot>
|
</tfoot>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
foreach( get_lostitems() as $item){
|
foreach( get_lostitems(true) as $item){
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $item["id"]; ?></td>
|
<td><?php echo $item["id"]; ?></td>
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
</tfoot>
|
</tfoot>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
foreach( get_founditems() as $item){
|
foreach( get_founditems(true) as $item){
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $item["id"]; ?></td>
|
<td><?php echo $item["id"]; ?></td>
|
||||||
|
|
Loading…
Reference in a new issue