Friday, 11 August 2017

mysql - Parse error: syntax error, unexpected ';' in C:xampphtdocswebdevauto-parts-dbsubmit_processor.php on line 6




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




Add Auto Part


Part Name:



SKU:



Vehicle Make:




Vehicle Model:



Vehicle Year:













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

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...