I'm sure this is a dumb question, but I'm somewhat new to hard coding queries into php files and I cannot figure out why I'm getting this error.
What I'm trying to do is add text input in a form into columns on a database table. Here's what I have:
form.php
submit_processor.php
//Connecting to sql db.
$connect = mysqli_connect("my host","my user","my password","my db");
//Sending form data to sql db.
mysqli_query($connect,"INSERT INTO auto_parts (available_parts, partSKU, vehicle_make, vehicle_model, vehicle_year)
VALUES ('$_POST[available_parts]', '$_POST[partSKU]', '$_POST[vehicle_make]', '$_POST[vehicle_model]', '$_POST[vehicle_year]')";
?>
Any help would be great!
Answer
Missing ) at last
mysqli_query($connect,"INSERT INTO auto_parts (available_parts, partSKU, vehicle_make, vehicle_model, vehicle_year)
VALUES ('$_POST[available_parts]', "
. "'$_POST[partSKU]',"
. "'$_POST[vehicle_make]', "
. "'$_POST[vehicle_model]', '$_POST[vehicle_year]')");
^//missing )
No comments:
Post a Comment