Hello, kindly look at my php code to insert registration data into a MySQL database. Here is the code below and further below, the error response I keep getting.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$servername = "localhost";
$username = "emiola";
$password = "emmybaba2020";
$dbname = "tutors";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn) {
die("Connection failed: " . $conn->connect_error);
}
if (isset($_POST['submit']))
{
$title = $_POST['title'];
$firstname = $_POST['firstname'];
$flastname = $_POST['lastname'];
$email = $_POST['email'];
}
$sql = "INSERT INTO tutorsignup (firstname, lastname, email)
VALUES ('$firstname', '$lastname', '$email')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
Error Message
connect_error); } if (isset($_POST['submit'])) { $title = $_POST['title']; $firstname = $_POST['firstname']; $flastname = $_POST['lastname']; $email = $_POST['email']; } $sql = "INSERT INTO tutorsignup (firstname, lastname, email) VALUES ('$firstname', '$lastname', '$email')"; if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "
" . $conn->error; } $conn->close(); ?>
Thank you.