Reputation: 17457
I'm getting a strange error in a Laravel project I'm working on.
SQLSTATE[HY000]: General error: 20018 Incorrect syntax near '='. [20018] (severity 15) [(null)] (SQL: update [plan_part] set [is_corrosion_protection_required] = 0, [modified_date] = 2018-01-24 11:47:03 where [plan_part_id] = 131996)
It is happening on my test server, but locally it is working. The test server is running PHP 7.1.10 and the localhost is WAMP running 7.0.10.
I don't understand why this is causing an error. The syntax appears to be correct. I'm just using Laravel's eloquent model to save to the database, which I'm pretty sure is just a PHP PDO bound parameter statement.
Strangely, I am able to save on the test server if I tweak a different property other than is_corrosion_protection_required
. That property is a bit
property in the DB. I tried changing it to use true/false, 1/0, '1'/'0' and 'yes'/'no', but it didn't fix anything.
I am getting the same problem on another bit field, so I think it has to do with that, but I have no idea what I need to do or where to go from here.
Hoping someone can provide some clues as to what else I can try or what I need to do to get this working on both localhost and the test server.
I don't think the more updated 7.1 version is a major problem, but I don't know much about server administration.
Upvotes: 1
Views: 8368
Reputation: 6244
This problem happen from server side not from your project, You need to make sure you are complete and success install sqlsrv
and pdo_sqlsrv
modules on server.
When you run these command pecl install pdo_sqlsrv
and pecl install sqlsrv
, make sure the process done successful, and you see this message at end of process:
Build complete.
Don't forget to run 'make test'.
Upvotes: 0
Reputation: 17457
After many hours of research, I was able to come to the conclusion that our problem was not with the original query that is outlined in the error message.
There were triggers associated with the table in question and those triggers were potentially the root cause of the problem. I can't say for certain what exactly was throwing the error, but our DBA reviewed the triggers and disabled them causing everything to work again.
Thanks for all the comments and assistance in reviewing my thoughts.
Upvotes: 0