My software setup (I'm running WAMP5)
PHP: 5.1.4
MySql: 5.0.22-community-nt
Apache: 2.0.58 (Win32)
I am making an "add manufacturer page". I have the form on "add.php", and the processing of the form on "add_proc.php".
I have echoed all my form fields over to the "add_proc.php" page, and I can see all my variables passed through from "add.php". However, I am getting the following error:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 12"
Now, when I look at the php snippet at the top of the "add_proc.php" page, my code looks like so (I use this code on almost all my pages without a hitch):
<?php
if ($_GET['SID'] == ""){
header("location: index.php");
exit;
}else {
session_id($_GET['SID']);
session_start();
$SessID = $_GET['SID'];
header("Cache-control: private");
if ($_SESSION['IP'] != $REMOTE_ADDR){
header("location: index.php");
exit;
}
}
$UserID = $_SESSION['UserID'];
include ("manufacturer_vals.php");
include ("DBConnect.php"); ?>
Line 12 here is "exit;"
After this chunk of php code, I have the following code:
<php
$result1 = mysql_query (
"INSERT INTO make SET
MakeName = '$MakeName',
MakeDescription = '$MakeDescription',
MakeOriginCountry = '$MakeOriginCountry',
MakeAddress1 = '$MakeAddress1',
MakeAddress2 = '$MakeAddress2',
MakeCity = '$MakeCity',
FK_StateID = '$FK_StateID',
MakeZip = '$MakeZip',
MakePhone = '$fullphone',
MakeUrl = '$MakeUrl',
MakeEmail = '$MakeEmail',
");
if (!$result1){
echo (mysql_error());}
else {
//upon good addition to db, the following will display to the user:
echo"<p align=center><span class=style34>Manufacturer has been added successfully!</span></p>";
} ?>
If I add or take away any additional php code, it always returns that the error is with line 12. It never changes from line 12.
What could be the problem with my code?