fixed wrong statement

This commit is contained in:
Jan Felix Wiebe 2018-12-28 01:37:28 +01:00
parent 19fccd3abe
commit de5e27b172

View file

@ -23,7 +23,7 @@ function auth(){
function get_founditems($onlyUnmatched = false){ function get_founditems($onlyUnmatched = false){
global $mysqli; global $mysqli;
if ($onlyUnmatched) { 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 DESC"); $res = $mysqli->query("SELECT items.* FROM items LEFT JOIN matches ON items.id = matches.l_id WHERE matches.l_id IS NULL ORDER BY items.id DESC");
} else { } else {
$res = $mysqli->query("SELECT * FROM items ORDER BY id ASC"); $res = $mysqli->query("SELECT * FROM items ORDER BY id ASC");
} }
@ -37,7 +37,7 @@ function get_founditems($onlyUnmatched = false){
function get_lostitems($onlyUnmatched = false){ function get_lostitems($onlyUnmatched = false){
global $mysqli; global $mysqli;
if ($onlyUnmatched) { 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 DESC"); $res = $mysqli->query("SELECT lost.* FROM lost LEFT JOIN matches ON lost.id = matches.f_id WHERE matches.f_id IS NULL ORDER BY lost.id DESC");
} else { } else {
$res = $mysqli->query("SELECT * FROM lost ORDER BY id ASC"); $res = $mysqli->query("SELECT * FROM lost ORDER BY id ASC");
} }