Skip to content
Advertisement

Mysql queries giving error after upgrading

why this simple query not working. I know it was OK before I upgraded my mysql version. i know there are some syntax changes in new version that I done. but this is simple query no join, but not working.

SELECT * FROM ship WHERE sensitive='Y' and entry_date between  $startdate and $enddate

Please help me.

EDIT:

Upgraded from mysql4 to mysql5 and error is ‘syntax error’

Advertisement

Answer

I think you upgraded from mysql 4 to 5 . sensitive is new reserved keyword in mysql5. You need to enclose it in backticks(`) while using it in query. Mysql 5 allows reserved words to be used is query but with backticks.

Try:

SELECT * FROM ship WHERE  `sensitive`='Y' and entry_date between  $startdate and $enddate
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement