initial commit
This commit is contained in:
27
categoria/proc_del_cat.php
Normal file
27
categoria/proc_del_cat.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once("..\conexao.php");
|
||||
|
||||
$id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
|
||||
$nome = filter_input(INPUT_POST, 'nome', FILTER_SANITIZE_STRING);
|
||||
|
||||
$verif="SELECT * from servicos WHERE id_categoria='$id'";
|
||||
$resu= mysqli_query($con, $verif);
|
||||
if (mysqli_affected_rows($con)){
|
||||
$_SESSION['msg'] = "<p style='color:green;'>Esta categoria não pode ser excluída, pois existe serviço cadastrado</p>";
|
||||
header("Location: index.php");
|
||||
}else{
|
||||
|
||||
$result= "DELETE FROM categoria WHERE id='$id'";
|
||||
$resultado= mysqli_query($con, $result);
|
||||
|
||||
|
||||
if(mysqli_affected_rows($con)){
|
||||
$_SESSION['msg'] = "<p style='color:green;'>Categoria excluida com sucesso</p>";
|
||||
header("Location: index.php");
|
||||
}else{
|
||||
$_SESSION['msg'] = "<p style='color:red;'>Categoria não foi excluida</p>";
|
||||
header("Location: edit_cat.php?id=$id");
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user