Advertisement
mvsp

delete.php

Jul 7th, 2021
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. <?php
  2. //Sessão
  3. session_start();
  4.  
  5. //Conexão
  6. require_once 'db_connect.php';
  7.  
  8. if(isset($_POST['btn-deletar'])):
  9.    
  10.  
  11.     $id = mysqli_escape_string($connect, $_POST['id']);
  12.  
  13.     $sql = "DELETE FROM clientes WHERE id = '$id' ";
  14.  
  15.     if(mysqli_query($connect,$sql)):
  16.         $_SESSION['mensagem'] = "Deletado com sucesso!";
  17.         header('Location: ../index.php');
  18.     else:
  19.         $_SESSION['mensagem'] = "Erro ao deletar";
  20.         header('Location: ../index.php');
  21.     endif;
  22. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement