$sql = "INSERT INTO `liftcentrale`(`timedate`,`vraagaanbod`, `date`, `from_place`, `to_place`, `name`, `email`, `gender`, `smoke`, `extra`, `freeyesno`, `price_euro`, `firsttimeryesno`, `seats_offered`)
VALUES (CURRENT_TIMESTAMP,'$vraagaanbod','$date','$from_place','$to_place','$name','$email','$gender','$smoke','$extra','$freeyesno','$price_euro','$firsttimeryesno','$seats_offered');";
echo $sql; //CHECK QUERY STRING
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
I tried using phpMyAdmin to create php statements. Changed the single parentheses that phpMyAdmin created for ‘normal’ ones. Tried and tested over & again. Can’t find a working solution otherwise would not be here. For some reason, I can not even see the query string.
2
Answers
Checking my error logs definitely helped, after I installed MAMP on my own laptop to see what these logs said. DB name was wrong, and the date format. I now can insert data into MySQL. Thanks for all the help!
Try like this