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 'WHERE link.privado= 0 ORDER BY fecha DESC' at line 1SELECT DISTINCT link.* FROM sabrosus AS link WHERE id_category=11 WHERE link.privado= 0 ORDER BY fecha DESC