Check before doing the database update

This commit is contained in:
Michael Vogel 2016-04-28 06:56:55 +02:00 committed by Roland Haeder
parent 098ac5b077
commit 0c9c58a683
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78

View file

@ -1335,9 +1335,12 @@
$idlist = implode(",", $idarray);
if ($idlist != "")
$r = q("UPDATE `item` SET `unseen` = 0 WHERE `unseen` AND `id` IN (%s)", $idlist);
if ($idlist != "") {
$unseen = q("SELECT `id` FROM `item` WHERE `unseen` AND `id` IN (%s)", $idlist);
if ($unseen)
$r = q("UPDATE `item` SET `unseen` = 0 WHERE `unseen` AND `id` IN (%s)", $idlist);
}
$data = array('$statuses' => $ret);
switch($type){