Jump to content

[SOLVED] insert into / update


knowram

Recommended Posts

I have a page with several text boxes and one text area. For some reason when I submit the information the first time using an insert into statement everything works fine. If I try to edit the info and submit it again with an update statement I get a syntax error. Not really sure what the problem is.

 

here is the code that I am working with

insert statement 

$query = "INSERT INTO aDeviceInfo(
							nDeviceID,
							Contract_Number,
							Contract_Type,
							Bill_To_Name,
							Item_Start_Date,
							Item_End_Date,
							Item_Status,
							Item_Info)
						values(
							'$_SESSION[nDeviceID]',
							'$_SESSION[Contract_Number]',
							'$_SESSION[Contract_Type]',
							'$_SESSION[bill_To_Name]',
							'$_SESSION[item_Start_Date]',
							'$_SESSION[item_End_Date]',
							'$_SESSION[item_Status]',
							'$_SESSION[item_Info]')";

		Mysql_query($query) or
			die (mysql_error());

update statement 

$query = "UPDATE `aDeviceInfo` SET
			`Contract_Number` = '$_SESSION[Contract_Number]',
			`Contract_Type` = '$_SESSION[Contract_Type]',
			`Bill_To_Name` = '$_SESSION[bill_To_Name]',
			`Item_Start_Date` = '$_SESSION[item_Start_Date]',
			`item_End_Date` = '$_SESSION[item_End_Date]'
			`Item_Status` = '$_SESSION[item_Status]',
			`Item_Info` = '$_SESSION[item_Info]'
			WHERE
			`nDeviceID` = '$_SESSION[nDeviceID]';";

		Mysql_query($query) or
			die (mysql_error());

 

this is the error that I am getting

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 'Item_Status` = 'Yes', `Item_Info` = 'NAME: "2821 chassis", DESCR:' at line 7

 

and here is the text in the text box that I am trying to update. it is the same as what I inserted the first time around

NAME: "2821 chassis", DESCR: "2821 chassis, Hw Serial#: FTX108C37H, Hw Revision: 52.57"
PID: CISCO2821         , VID: V02 , SN: FTX100C37H

NAME: "Two port T1 voice interface daughtercard", DESCR: "Two port T1 voice interface daughtercard"
PID: VWIC-2MFT-T1=     , VID: 1.0, SN: 3427362   

NAME: "One port T1 voice interface daughtercard", DESCR: "One port T1 voice interface daughtercard"
PID: VWIC-1MFT-T1=     , VID: 1.0, SN: 3424041   

NAME: "WAN Interface Card - DSU/CSU T1 Fractional (V2)", DESCR: "WAN Interface Card - DSU/CSU T1 Fractional (V2)"
PID:                   , VID: 1.2, SN: FOC1001AMB

NAME: "PVDMII DSP SIMM with Two DSPs", DESCR: "PVDMII DSP SIMM with Two DSPs"
PID: PVDM2-32          , VID: NA  , SN: FOC0063H8T

NAME: "PVDMII DSP SIMM with Two DSPs", DESCR: "PVDMII DSP SIMM with Two DSPs"
PID: PVDM2-32          , VID: NA  , SN: FOC1004175

 

I hope someone has an idea because i am lost.

 

thanks for any help.

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

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.