From c34316999dc1b812ad155f95e56190a71d21b2b8 Mon Sep 17 00:00:00 2001 From: GabrielPintoSouza Date: Fri, 5 Jul 2024 09:11:41 -0300 Subject: [PATCH] =?UTF-8?q?Resolu=C3=A7=C3=A3o=20da=20issue=20#436?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/AlmoxarifeDAO.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dao/AlmoxarifeDAO.php b/dao/AlmoxarifeDAO.php index c66557ed..d81e4a02 100755 --- a/dao/AlmoxarifeDAO.php +++ b/dao/AlmoxarifeDAO.php @@ -16,16 +16,19 @@ public function listarTodos(){ ")->fetchAll(PDO::FETCH_ASSOC); return json_encode($almoxarife); }catch (PDOException $e){ - echo 'Error:' . $e->getMessage(); + echo 'Erro ao listar almoxarifes: ' . $e->getMessage(); } } public function excluir($id){ try { $pdo = Conexao::connect(); - $pdo->exec("DELETE FROM almoxarife WHERE id_almoxarife=$id;"); + $sql = "DELETE FROM almoxarife WHERE id_almoxarife=:id"; + $stmt = $pdo->prepare($sql); + $stmt->bindParam(':id', $id); + $stmt->execute(); } catch (PDOException $e) { - echo 'Error:' . $e->getMessage(); + echo 'Erro ao excluir almoxarife: ' . $e->getMessage(); } } }