-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemp_update_details_code.php
More file actions
39 lines (34 loc) · 1.09 KB
/
emp_update_details_code.php
File metadata and controls
39 lines (34 loc) · 1.09 KB
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
<?php
session_start();
$logged_in_id = $_SESSION['login_id'];
//check if value exixts
if(!empty($logged_in_id)){
//create connection
$conn = new mysqli("localhost", "root", "", "museumsys");
if(mysqli_connect_error()){
die('Connect Error('.mysqli_connect_errno().')'.mysqli_connect_error());
}
else{
//getting new values to be updated
$name = $_POST['name'];
$email = $_POST['email'];
$country = $_POST['country'];
$password = $_POST['password'];
$phone = $_POST['phone'];
$dob = $_POST['dob'];
//query for updating values
$UPDATE = "UPDATE staff SET name=?, email=?, country=?, pass_word=?, phone=?, DOB=? WHERE staffid=? LIMIT 1";
$stmt = $conn->prepare($UPDATE);
$stmt->bind_param("sssssss", $name, $email, $country, $password, $phone, $dob, $logged_in_id);
$stmt->execute();
$_SESSION['msg'] = "<script>window.alert('Details updated successfully.')</script>";
header("location: employee_menu.php");
}
$stmt->close();
$conn->close();
}
else{
$_SESSION['msg'] = "<script>window.alert('Login ID not present')</script>";
header('location: employee_menu.php');
}
?>