First, Create Mysql Username and Password and Database
Second, Create a Table "sms" in Database
Third, Create a Row "id and title" in Table.
Then, Edit following codes to connect your database and username with Mysql.
Then, Create a file "insert.php" and add following codes inside of the file.
connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO MyGuests (firstname, lastname, email)
VALUES ('John', 'Doe', 'john@example.com')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . " " . $conn->error;
}
$conn->close();
?>
Full Codes
connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO MyGuests (firstname, lastname, email)
VALUES ('John', 'Doe', 'john@example.com')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . " " . $conn->error;
}
$conn->close();
?>
Source: www.w3schools.com |