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 1 (select s.id_subcategoria,s.nombre from subcategoria s inner join categoriaXsubcategoria x on s.id_subcategoria=x.id_subcategoria where x.id_categoria=)