I've been working on integrating a Account RDBMS into my site but the MySQL system keeps throwing a syntax error. This is my first time using SQL outside of a Python environment, hence my issues. Below is the segment of code which I believe is causing the issues. The rest of the PHP is operating fine as I've been verifying with each adjustment.
$wname = $_POST["wname"];
$email = $_POST["email"];
$pword = $_POST["pword"];
$dob = $_POST["dob"];
$accd = uniqid();
/*echo $wname . " " . $email . " " . $pword . " " . $dob . " " . $accd;*/
$sql = "INSERT INTO 'Starting Account Data' ('Whole Name', 'Email', 'Password', 'DOB', 'Account Code') VALUES ('" . $wname . "', " . "'" . $email . "', " . "'" . $pword . "', " . "CAST('" . $dob . "' AS DATE), " . "'" . $accd . "')";
/*echo $sql;*/
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
Note that I intend on inserting $dob
as a date type in the DB.
Does anyone have any ideas as to the cause of my syntax errors, or any suggestions?