public function Insert(Contest $data) { try { $query = "INSERT INTO Concursos (id_type, name, question, initial_date, final_date, winner, active)\n VALUES (?, ?, ?, ?, ?, ?, ?)"; $this->pdo->prepare($query)->execute(array($data->__GET('id_type'), $data->__GET('name'), $data->__GET('question'), $data->__GET('initial_date'), $data->__GET('final_date'), $data->__GET('winner'), $data->__GET('active'))); } catch (Exception $e) { die($e->getMessage()); } }