Jump to content

Recommended Posts

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

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.