-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpegawai-delete.php
More file actions
28 lines (27 loc) · 871 Bytes
/
Copy pathpegawai-delete.php
File metadata and controls
28 lines (27 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
session_start();
include "koneksi.php";
$id_pegawai = $_GET['id_pegawai'];
$sql = "SELECT * FROM tbl_login WHERE id_pegawai = '$id_pegawai'";
$query = mysqli_query($koneksi, $sql);
if(mysqli_num_rows($query)>0){
$_SESSION['info'] = 'Gagal Dihapus';
}else{
// Cek apakah manajer sudah pernah input
$sql1 = "SELECT * FROM tbl_pegawai WHERE id_admin = '$id_pegawai'";
$query = mysqli_query($koneksi, $sql);
if(mysqli_num_rows($query)>0){
$_SESSION['info'] = 'Gagal Dihapus';
}else{
$sql1 = "DELETE FROM tbl_pegawai WHERE id_pegawai = '$id_pegawai'";
$hsl = mysqli_query($koneksi, $sql1);
if($hsl==1){
if($photo!=""){unlink("photo/".$photo);}
$_SESSION['info'] = 'Dihapus';
}else{
$_SESSION['info'] = 'Gagal Dihapus';
}
}
}
header("location:pegawai.php");
?>