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 community.communityid=1 ORDER BY lastverified desc' at line 1
SELECT * FROM org LEFT JOIN orgtocommunity ON (org.id = orgtocommunity.orgid) LEFT JOIN community ON (community.communityid=orgtocommunity.communityid) WHERE orgtype= and community.communityid=1 ORDER BY lastverified desc