Invalid query: 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 'Port from tbl_forecast_dry f where ID=7' at line 1 Whole query: select DISTINCT STR_TO_DATE(f.date_gmt,'%Y-%m-%d') date_gmt,f.PPPandStName=Phnom Penh Port from tbl_forecast_dry f where ID=7