示例#1
0
 /**
  * Delete a record by id from the table in context
  * @param  id $id the id of the record to be deleted
  * @return [type]     [description]
  */
 public static function destroy($id)
 {
     $table = self::getTableNameFromClass();
     self::getOne($id);
     $query = "DELETE FROM {$table} WHERE id = " . $id;
     try {
         Connection::db()->query($query);
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
示例#2
0
 /**
  * General Emoji Database Querier.
  *
  * @param string $query SQL query to be executed by the database
  *
  * @return $array SQl query results from the database
  */
 public static function getQueryResults($query)
 {
     $results = Connection::db()->query($query);
     $results->setFetchMode(PDO::FETCH_ASSOC);
     return $results->fetch();
 }