Invalid query: SELECT calle, numero, cp, hotel.id_destino, nombre_destino, usar_url_google_maps, link_google_maps, nombre_pais FROM hotel, destino, pais WHERE hotel.id_destino = destino.id_destino AND destino.id_pais = pais.id_pais AND activo = 1 AND id_hotel= 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 '' at line 6