tabela = (string) $tabela; $this->dados = $dados; $this->termos = (string) $termos; parse_str($parseString, $this->values); $this->getIntrucao(); $this->executarInstrucao(); } public function getResult() { return $this->result; } public function getMsg() { return $this->msg; } public function getRowCount() { return $this->query->rowCount; } public function conexao() { $this->conn = parent::getConn(); $this->query = $this->conn->prepare($this->query); } private function getIntrucao() { foreach ($this->dados as $key => $value) { $values[] = $key . ' = :' . $key; } $values = implode(', ', $values); $this->query = "UPDATE {$this->tabela} SET {$values} {$this->termos}"; } private function executarInstrucao(){ $this->conexao(); try { $this->query->execute(array_merge($this->dados, $this->values)); $this->result = true; $this->msg = "
Usuário alterado com sucesso!
"; } catch (Exception $e) { $this->result = null; $this->msg = "
Erro ao Alterar {$e->getMessage()}
"; } } }