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
https://forums.phpfreaks.com/topic/59445-solved-insert-into-update/
Share on other sites

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.