-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathedit-profile.php
More file actions
34 lines (22 loc) · 909 Bytes
/
edit-profile.php
File metadata and controls
34 lines (22 loc) · 909 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
29
30
31
32
33
34
<?php
include "connection.php";
$sql = "UPDATE `users` SET `full_name` = :full_name,
`email` = :email,
`password` = :password,
`phone` = :phone,
`age` = :age
WHERE id = '".$_POST["id"]."' ";
$statement = $conn->prepare($sql);
$statement->bindValue(':full_name', $_POST['full_name']);
$statement->bindValue(':email', $_POST['email']);
$statement->bindValue(':password', $_POST['password']);
$statement->bindValue(':phone', $_POST['phone']);
$statement->bindValue(':age', $_POST['age']);
$updated = $statement->execute();
if($updated){
$sth = $conn->prepare("SELECT * FROM users WHERE id = '".$_POST["id"]."' " );
$sth->execute();
$result2 = $sth->fetch(PDO::FETCH_ASSOC);
echo json_encode($result2);
}
?>