Check before doing the database update

pull/2489/head
Michael Vogel 2016-04-28 06:56:55 +02:00
parent 64595e9a2d
commit 5e4a2badb2
1 changed files with 5 additions and 2 deletions

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){