Jump to content

Error message = You have an error in your SQL syntax;


jponte

Recommended Posts

Hi,

I can see that the query displays what I want and the values are passed correctly but I get the 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 'values ('1002090352', 'RMA999', '02/20/2010', '215-487-5545', 'RIM', '5544523', ' at line 1

 

The Query1 is:

INSERT into values ('1002090352', 'RMA999', '02/20/2010', '215-487-5545', 'RIM', '5544523', '535486878787879', 'Purple', 'fgdfsdfgsdfgsdf', 'Y', 'Y', 'Y', 'Y', 'fdgdfgdsfgsdfg', '1')

 

The code is as follows:

 

if(!isset($ContactIDVal)){

$Query2 = "INSERT into $rma_devices values (NULL, '$ShipAttention', '$ShipPhone', '$ShipEmail', '$ShipStreet', '$ShipAddinfo', '$ShipCity', '$ShipProv', '$ShipPCode', '$ShipAddNotes')";

//Get the generated ID for Contact_ID	
$Gen_Contact_ID = mysql_insert_id();

echo $Gen_Contact_ID;

$Query = "INSERT into $rma_devices values ('$RMANumber', '$CustomerID', '$RMADate', '$DevicePhone', '$DeviceType', '$DeviceModel', '$DeviceIMEI', '$DeviceColor', '$DescDefect', '$ResetDevice', '$SoftwareReload', '$WipeDevice', '$TroubOther', '$TroubNotes', '$Gen_Contact_ID')";
}
else{

$Gen_Contact_ID = $contactinfo ['Contact_ID'];

print ("<BR>Break: $Gen_Contact_Info<BR>\n");

$Query = "INSERT into $rma_devices values ('$RMANumber', '$CustomerID', '$RMADate', '$DevicePhone', '$DeviceType', '$DeviceModel', '$DeviceIMEI', '$DeviceColor', '$DescDefect', '$ResetDevice', '$SoftwareReload', '$WipeDevice', '$TroubOther', '$TroubNotes', '$Gen_Contact_ID')";
}

if (!$link = mysql_connect('localhost', 'root', 'escrma')) {
    echo 'Could not connect to mysql';
    exit;
}

if (!mysql_select_db('rma_portal', $link)) {
    echo 'Could not select database';
    exit;
}

print ("<br>The Query2 is:<BR>$Query2<P>\n");
print ("<br>The Query1 is:<BR>$Query<P>\n");

if (mysql_db_query ($DBName, $Query, $Link)) {
print ("The RMA form has been saved to the ESC database<br>\n");
} else {print ("There was a problem saving the RMA form to the database<br>Please contact ESC at 1-877-939-3282\n");
	echo "<BR><BR>Error message = ".mysql_error(); 
}
mysql_close ($Link);

 

I checked the MYSQL table and everything is OK there.

 

Thanks for your help

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.