コード例 #1
0
ファイル: Permissions.php プロジェクト: pkrll/Helium
 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
ファイル: Model.php プロジェクト: pkrll/Philotes
 /**
  * Executes an SQL query string.
  *
  * @param   string  Optional. The SQL query to execute.
  * @param   array   Optional. Additional parameters to
  *                  supply to the query.
  * @return  array | bool
  */
 private function execute($query = NULL, $params = NULL)
 {
     if ($this->database === NULL) {
         return $this->errorMessage("No database connection found.");
     }
     if ($query !== NULL) {
         $this->database->prepare($query);
     }
     // Execute the query, but brace for errors.
     $error = $this->database->execute($params);
     if ($error !== NULL) {
         return $this->errorMessage($error);
     }
     return TRUE;
 }