forked from ishant-kumar/ProjWork
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMySQLDataBase.php
More file actions
32 lines (24 loc) · 872 Bytes
/
MySQLDataBase.php
File metadata and controls
32 lines (24 loc) · 872 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
<?php
$servername = "projworkrds123.clrmluzpx2iu.us-east-1.rds.amazonaws.com";
$username = "ProjWorkRDS123";
$password = "ProjWorkRDS123";
$dbname = "ProjWorkDB123";
$id = $_POST["id"];
$lastname = $_POST["lastname"];
$firstname = $_POST["firstname"];
$address = $_POST["address"];
$city = $_POST["city"];
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO Persons VALUES ('$id','$lastname','$firstname','$address','$ city')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>