I’m working on modifying records in my database table based on a specific customer ID, but I keep getting a syntax error message. Can someone help me figure out what I’m doing wrong?
Here’s what my query looks like when I print it out:
The MySQL error says there’s something wrong with the syntax around ‘weekend performance shows improvement compared to weekday metrics but requires’ on line 10. I can’t see what’s causing this problem. Any ideas what might be missing or incorrect in my UPDATE statement?
hmm, that’s odd - your query seems okay. but check if that’s what’s really running? sometimes print statements can be misleading with string escaping. maybe try a simpler version first and see if you still get an error?
This happens because MySQL’s strict mode clashes with how you’re handling strings. When the error points to specific text in your message, it means the database is choking on special characters. I’ve hit this same issue with user content updates. Stop concatenating strings in your query - use parameterized queries instead. This completely avoids syntax conflicts. Most database connectors have prepared statements that handle string escaping automatically. Quick test: swap your custom_message with something basic like ‘test message’ to confirm that’s the problem before you fix it properly.
Looks like a quote escaping problem. That apostrophe in ‘Your weekend performance…’ is probably breaking your string. Try wrapping the whole message in double quotes or escape the apostrophe with a backslash like 'Your weekend'. Should fix it.