Syntax Error in UPDATE statement

Bobby9779

Registered User.
Local time
Yesterday, 22:25
Joined
Aug 4, 2011
Messages
13
The $id and $date parts are variables within my php code.

Code:
UPDATE Temp_Allocation
SET Service_ID=$id 
WHERE [Date]='$date' 
AND Duty_ID='2'

If in access I change the variables to the figures that the variables represent, it works.

If I try to run this within the php code I get the syntax error!

Please help!
 
Syntax error generally means a misplaced quote, apostrophe, semi-colon or bracket. Post your actual php code not just what you think the query is.

Without the actual php code to look at, here's a few notes about your query:
1. Its never good to have a field in a table called 'Date'.
2. Is Duty_ID a text field? If not, then why do you have single quote marks around the 2?
3. Your query doesn't end with a semi-colon.

Again, post the actual php code if you still need help.
 

Users who are viewing this thread

Back
Top Bottom