public static function findOne($id) { $sql = 'SELECT * FROM ' . static::getTable() . ' WHERE articleId = :articleId'; $db = new Database(); $result = $db->selectOne(static::class, $sql, [':articleId' => $id]); if ($result == false) { throw new MyException('E404'); } else { return $result; } }
public static function checkSess() { $sql = 'SELECT userId FROM ' . static::getTable() . ' WHERE userSess = :userSess'; $db = new Database(); return $db->selectOne(static::class, $sql, [':userSess' => $_SESSION['sess']]); }