forked from if-itb/IF3110-2015-T1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditdata.php
30 lines (25 loc) · 861 Bytes
/
editdata.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
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "stackexchange";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$Name = mysqli_real_escape_string($conn,$_POST["Name"]);
$Email = mysqli_real_escape_string($conn,$_POST["Email"]);
$Topik = mysqli_real_escape_string($conn,$_POST["Topik"]);
$Content = mysqli_real_escape_string($conn,$_POST["Content"]);
$qid = $_GET["id"];
$sql = "UPDATE question SET Name='$Name',Email='$Email',Topik='$Topik',Content='$Content' WHERE QID=$qid";
if ($conn->query($sql) === TRUE ){
echo "Record updated successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
header("Location: index.php");
?>