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 t1.id != 12 ORDER BY path' at line 12
SELECT TRIM( LEADING '; ' FROM CONCAT( IFNULL( t5.name, '' ) , '; ', IFNULL( t4.name, '' ) , '; ', IFNULL( t3.name, '' ) , '; ', IFNULL( t2.name, '' ) , '; ', IFNULL( t1.name, '' ) ) ) AS path , TRIM( LEADING '; ' FROM CONCAT( IFNULL( t5.id, '' ) , '; ', IFNULL( t4.id, '' ) , '; ', IFNULL( t3.id, '' ) , '; ', IFNULL( t2.id, '' ) , '; ', IFNULL( t1.id, '' ) ) ) AS pathid FROM jos_djcf_categories t1 LEFT JOIN jos_djcf_categories t2 ON t1.parent_id = t2.id LEFT JOIN jos_djcf_categories t3 ON t2.parent_id = t3.id LEFT JOIN jos_djcf_categories t4 ON t3.parent_id = t4.id LEFT JOIN jos_djcf_categories t5 ON t4.parent_id = t5.id WHERE t1.id = AND t1.id != 12 ORDER BY path