Пример #1
0
 protected function getUserPermissions($userID)
 {
     $sqlQuery = "SELECT permission FROM Users WHERE id = :id LIMIT 1";
     $sqlParam = array("id" => $userID);
     $this->database->prepare($sqlQuery);
     $this->database->execute($sqlParam);
     $response = $this->database->fetch();
     return isset($response['permission']) ? $response['permission'] : FALSE;
 }
Пример #2
0
 /**
  * Run the supplied query. Only for fetching rows from
  * the database.
  *
  * @param   string  Optional. The SQL query to execute.
  * @param   array   Optional. Additional parameters to
  *                  supply to the query.
  * @param   bool    If true, fetches all matching rows.
  *                  Defaults to TRUE.
  * @return  array
  **/
 protected final function read($query = NULL, $params = NULL, $fetchAll = TRUE)
 {
     $execution = $this->execute($query, $params);
     if ($execution !== TRUE) {
         return $execution;
     }
     if ($fetchAll) {
         return $this->database->fetchAll();
     }
     return $this->database->fetch();
 }