Jump to content

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


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.