-
Notifications
You must be signed in to change notification settings - Fork 5
/
delete-search-teacher.php
executable file
·47 lines (42 loc) · 1.31 KB
/
delete-search-teacher.php
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
include_once 'includes/db_connect.php';
session_start();
if (!isset($_SESSION['aai']))
{header("Location: login-index.php");
}
$id=$_POST["uname"];
$_SESSION['showdelete']=0;
$tables = "teacher";
$search_sql = "SELECT * FROM `{$tables}` where userid='$id'";
$search_result = $conn->query($search_sql);
if ($search_result->num_rows > 0) {
$table_found = $tables;
}
$table_found_sql = "SELECT * FROM `{$table_found}` where userid='$id'";
$table_found_result = $conn->query($table_found_sql);
if ($table_found_result->num_rows > 0) {
session_start();
$row = mysqli_fetch_array($table_found_result);
$_SESSION['dtable_found']=$table_found;
$_SESSION['duserid']=$row['userid'];
$_SESSION['dfname']=$row['fname'];
$_SESSION['dmname']=$row['mname'];
$_SESSION['dlname']=$row['lname'];
$_SESSION['daddress']=$row['address'];
$_SESSION['demail']=$row['email'];
$_SESSION['dyear']=$row['year'];
$_SESSION['ddept']=$row['dept'];
$_SESSION['dimage']=$row['image'];
$_SESSION['searched']="1";
$_SESSION['delete']='1';
$_SESSION['showdelete']='1';
header("Location: tab-teacher.php");
}
else{
session_start();
$_SESSION['search-errord'] = '*User ID not fount';
$_SESSION['delete']='1';
$_SESSION['showdelete']='0';
header("Location: tab-teacher.php");
}
?>