initial commit
This commit is contained in:
26
prestadores/proc_del_pre.php
Normal file
26
prestadores/proc_del_pre.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
session_start();
|
||||
include("../conexao.php");
|
||||
|
||||
$id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
|
||||
$nome = filter_input(INPUT_POST, 'nome', FILTER_SANITIZE_STRING);
|
||||
|
||||
$verif="SELECT * from orcamentos, prestadores_servicos WHERE id_prestador='$id'";
|
||||
$resu= mysqli_query($con, $verif);
|
||||
if (mysqli_affected_rows($con)){
|
||||
$_SESSION['msg'] = "<p style='color:green;'>Este prestador não pode ser excluído, pois existe orçamento ou prestadores_serviços cadastrado</p>";
|
||||
header("Location: index.php");
|
||||
}else{
|
||||
$result= "DELETE FROM prestadores WHERE id='$id'";
|
||||
$resultado= mysqli_query($con, $result);
|
||||
|
||||
|
||||
if(mysqli_affected_rows($con)){
|
||||
$_SESSION['msg'] = "<p style='color:green;'>Prestador excluido com sucesso</p>";
|
||||
header("Location: index.php");
|
||||
}else{
|
||||
$_SESSION['msg'] = "<p style='color:red;'>Prestador não foi excluido</p>";
|
||||
header("Location: edit_pre.php?id=$id");
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user