knowram Posted July 9, 2007 Share Posted July 9, 2007 Ok i am lost I don't understand how you can run an insert statement and not have any errors and then run a update statement and get errors with the same values. this is the code that i am working with $aDeviceInfo = mysql_query("select * from aDeviceInfo WHERE nDeviceID = '$_SESSION[nDeviceID]'")or die (mysql_error()); if (empty($aDeviceInfo)){ $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()); }else{ $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()); } if i am submit ing new info everything works fine. if i am up dating the i get this 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 'Item_Status` = 'Yes', `Item_Info` = 'NAME: "2821 chassis", DESCR:' at line 7 the full value of Item_Info is Item_Info = NAME: "2821 chassis", DESCR: "2821 chassis, Hw Serial#: FTX100C37H, Hw Revision: 52.57" PID: CISCO2821 , VID: V02 , SN: FTX1008C7H 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: FOC10061MB NAME: "PVDMII DSP SIMM with Two DSPs", DESCR: "PVDMII DSP SIMM with Two DSPs" PID: PVDM2-32 , VID: NA , SN: FOC100638T NAME: "PVDMII DSP SIMM with Two DSPs", DESCR: "PVDMII DSP SIMM with Two DSPs" PID: PVDM2-32 , VID: NA , SN: FOC1004175 hope this makes more sense to someone then it dose to me. thanks for the help Link to comment https://forums.phpfreaks.com/topic/59147-mysql_query/ Share on other sites More sharing options...
knowram Posted July 9, 2007 Author Share Posted July 9, 2007 I just realized that i was not paying attention at all to where i was posting this. it really belongs in either the mysql or php page. sorry Link to comment https://forums.phpfreaks.com/topic/59147-mysql_query/#findComment-293717 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.