Note No is a primary key in the Access table
I want to change the ID of no=290 to 11, and the following two sentences do not change after execution
$query = "Update sensors set id=11 where no=290";
$result = $conn->execute ($query);
-----------------------------------------------
But the following two sentences are effective after execution, can change the record ID of type=49 to 11
$query = "Update sensors set id=11 where type=49";
$result = $conn->execute ($query);
------------------------------------------------
Want to know why the value of the reference primary key is not possible?
Reply to discussion (solution)
Try this:
Update sensors set id=11 where no=290 and type=49
is not the primary key repeated ~
Try this:
Update sensors set id=11 where no=290 and type=49
is not the primary key repeated ~
The primary key system automatically increases, is unique, cannot have the duplicate value
My following sentence is OK, (XXXXXX is the specific need to update the field)
Update sensors set XXXXXXXX where id=15 and type=48 and Prop=0
Try this:
Update sensors set id=11 where no=290 and type=49
is not the primary key repeated ~
The primary key system automatically increases, is unique, cannot have the duplicate value
My following sentence is OK, (XXXXXX is the specific need to update the field)
Update sensors set XXXXXXXX where id=15 and type=48 and Prop=0
SELECT * from sensors where no=290 see
To help you go to the PHP area, is not the Type field is a character, change it to try
Update sensors set id=11 where type= ' 49 '
No is a reserved word for access (see http://office.microsoft.com/zh-cn/access-help/HA010030643.aspx)
Reserved words to avoid when selecting an identifier name
If it is already used and is inconvenient to modify, it should be escaped: enclosed in brackets
$query = "Update sensors set id=11 where [no]=290";
No is a reserved word for access (see http://office.microsoft.com/zh-cn/access-help/HA010030643.aspx)
Reserved words to avoid when selecting an identifier name
If it is already used and is inconvenient to modify, it should be escaped: enclosed in brackets
$query = "Update sensors set id=11 where [no]=290";
Test, indeed, as the upstairs said no is reserved word, it is wrapped in square brackets to get the correct results, thank you, knot to points! ~