/** * Checks if exist user with this e-mail * * @param string $email (e-mail) * @return boolean */ public static function checkEmail($email) { $db = dbConection::get(); $query = "SELECT `id` FROM `users`" . " WHERE `email`=:email"; $sth = $db->prepare($query); $sth->bindParam(':email', $email, PDO::PARAM_STR, 255); $sth->execute(); if ($sth->fetch()) { return TRUE; } return FALSE; }
/** * Changes task status * * @param integer $id * @param integer $status * @return boolean */ public static function changeStatus($id, $status) { $db = dbConection::get(); if (!$db) { return FALSE; } $query = 'UPDATE `tasks` SET `status`=:status' . ' WHERE `id`=:id'; $stm = $db->prepare($query); $stm->bindParam(':status', $status, PDO::PARAM_INT); $stm->bindParam(':id', $id, PDO::PARAM_INT); return $stm->execute(); }