if( $db->query("SELECT COUNT(*) FROM workdone WHERE mnumber=$up_mnumber AND session=$up_sessionid AND tstamp=$up_tstamp")->fetch(PDO::FETCH_NUM)[0] == 0 ) {
$db->query("DELETE FROM workdone WHERE mnumber=$up_mnumber AND session=$up_sessionid");
if( $db->query("SELECT COUNT(*) FROM workdone WHERE mnumber=$up_mnumber AND session=$up_sessionid AND tstamp=$up_tstamp")->fetch(PDO::FETCH_NUM)[0] == 0 ) {
$db->query("DELETE FROM workdone WHERE mnumber=$up_mnumber AND session=$up_sessionid");