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 cat.id_c=r.cat AND r.e=1 AND ubica.id_pd=r.ubica AND rub.id_r=cat.id_rub LIM' at line 1