From: Michael Vogel Date: Thu, 28 Apr 2016 04:56:55 +0000 (+0200) Subject: Check before doing the database update X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0c9c58a68398afe8dbea3c2f93e9549375ed885a;p=friendica.git Check before doing the database update --- diff --git a/include/api.php b/include/api.php index 996c52f54e..488e858445 100644 --- a/include/api.php +++ b/include/api.php @@ -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){