ERROR: 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 'AND rct.ID = rcts.ID_RCT AND rcts.ID_SERVICO = AND rct.FINALIZADO = 1 AND rct.' at line 1 | SELECT DATE_FORMAT(rct.DATA, '%b/%Y') as DATA_FORMATTED, rcts.* FROM rct, rct_servico rcts where rct.ID_CLIENTE = AND rct.ID = rcts.ID_RCT AND rcts.ID_SERVICO = AND rct.FINALIZADO = 1 AND rct.ATIVO = 1 ORDER BY rct.DATA DESC LIMIT 6