La consulta falló: 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 '$(this).data('id') '') order by a.xcomment_id desc limit 0,9' at line 6 sql--> select a.* ,date_format(a.xdatealta,'%d/%m/%Y') as xfecha ,date_format(a.xdatealta,'%H:%i') as xhora from comments a where a.xactivo=1 and a.xparent_id is null and a.xcomment_id in (select xcomment_id from `comments_cats` where xcategoria_id='' $(this).data('id') '') order by a.xcomment_id desc limit 0,9