-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.php
36 lines (27 loc) · 977 Bytes
/
update.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
<?php
session_start();
$servername = "localhost";
$username = "root";
$password = "2005eren07";
$dbname = "giftlist";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sessionusername = $_SESSION['username'];
$updatename = $_POST['updatename'];
$updateusername = $_POST['updateusername'];
$updatebirthday = $_POST['updatebirthday'];
$updatebgimg = $_POST['updatebgimg'];
$updatedescription = $_POST['updatedescription'];
$sql = "UPDATE users SET name='$updatename', username='$updateusername', bgimg='$updatebgimg', description='$updatedescription' WHERE username='$sessionusername'";
if ($conn->query($sql) === TRUE) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . $conn->error;
}
$conn->close();
header("location:profile.php?username=$sessionusername");
?>