for ($i = 0; $i < count($emps); $i++) { //HERE WE GONNA INSERT THE FOLLOWERS AND SEND A NOTIFICATION $db->query("SELECT id FROM tasks_followers WHERE task_id = :tid AND follower_id = :fid LIMIT :lmt"); $db->bind(":tid", $task); $db->bind(":fid", $emps[$i]); $db->bind(":lmt", 1); $get = $db->fetch(); if (empty($get)) { $db->query("INSERT INTO tasks_followers (task_id,follower_id) VALUES (:tsk,:flowr)"); $db->bind(":tsk", $task); $db->bind(":flowr", $emps[$i]); $db->execute(); } } $desc = 'You are called in a task by the assignee of that task <a href="taskDetails.php?k=' . $task . '">GO?</a>'; mInsertNotification($db, $emps, $desc); $db->endTransaction(); $res = 1; } catch (Exception $e) { $db->cancelTransaction(); $res = 3; } } else { $res = 2; } echo $res; } elseif (!empty($_POST['action']) && $_POST['action'] == "loginAction") { $username = $_POST['username']; $passowrd = $_POST['passowrd']; $remember = $_POST['remember']; $hr->query("SELECT * FROM users WHERE `email` = :em AND pass = :pass LIMIT 1");
if ($repeat == 2) { $repeatPeriod = 'weekly'; } else { if ($repeat == 3) { $repeatPeriod = 'monthly'; } else { $repeatPeriod = 'annually'; } } } } else { $repeatPeriod = 'from ' . $startDate . ' to ' . $endDate . ''; } $nontification = 'You have a task ' . $title . ' from ' . $craetorName . ' to ' . $desc . ' with period ' . $repeatPeriod . '.'; mInsertNotification($db, $assigneeId, $nontification); if ($followersIds != '') { $notifications = 'You are follower on a task ' . $title . ' from ' . $craetorName . ' to ' . $assigneeName . ' to ' . $desc . ' with period ' . $repeatPeriod . '.'; mInsertNotification($db, $followersArr, $notifications); } } $db->endTransaction(); $flag = 1; } catch (Exception $e) { $flag = 0; $db->cancelTransaction(); } echo $flag; } $db->closeConn(); $hr->closeConn(); ////////////////////////////////////////////////////////////////////////////