Ihsan
Ihsan

Reputation: 69

Sql Syntax error with Doctrine, probably because of change of Mysql version

I've programmed a project in symfony and mysql 5.6. then I uploaded my project to a remote server on 1&1. the remote server has mysql 5.7 version. All doctrine queries run ok and without problem. But when a user searches something, a request will be sent to the server and a doctrine query will be executed. Here it returns the following error:

SQLSTATE[42000]: Syntax error or access violation: 1064 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 'integer) BETWEEN 1940 AND 2002) AND u0_.id <> 2' at line 1

I think, it is probably because of different versions of mysql. Because on localhost it runs without problem Can you please help me how to solve it? is there a way to regenerate all the migrations according the new mysql version? or may be there is another solution? thanks

Upvotes: 1

Views: 340

Answers (1)

Ihsan
Ihsan

Reputation: 69

I was using CAST('number' as integer) in mysql 5.6. It did ok. However in mysql 5.7 and I do not know why, it does not run ok. So I changed it to CAST('number' as UNSIGNED) and it works ok

Upvotes: 0

Related Questions