-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdateuser.php
36 lines (27 loc) · 963 Bytes
/
updateuser.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
<?php
include 'components/function.php';
$conn = connection();
// include 'components/function.php';
if(isset($_POST['id']) || isset($_POST['name']) || isset($_POST['username']) || isset($_POST['phoneNum']) || isset($_POST['password']) || isset($_POST['role'])){
$id = $_POST['id'];
$name = $_POST['name'];
$username = $_POST['username'];
$phoneNum = $_POST['phoneNum'];
$password = $_POST['password'];
$role = $_POST['role'];
$no="";
$qUpdate = "UPDATE user SET name = '$name', username = '$username', password = '$password', nohp = '$phoneNum', role = '$role' WHERE Id = '$id'";
$update = mysqli_query($conn, $qUpdate);
if($update){
echo "<script>
alert('Data updated');
document.location.href = 'usersetting.php';
</script>";
}else{
echo "<script>
alert('Data not updated');
document.location.href = 'edituser.php';
</script>";
}
}
?>