A Database Error Occurred

Error Number: 1064

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 (page.pref_mainpage = 1) AND ((page.page_type = "campaign") OR ' at line 22

SELECT p_campaigndata.cid, p_campaigndata.non, p_campaigndata.expires, page.page_type, catLeft.title, page.purl, cRight.cname, cdataRight.description FROM p_campaigndata JOIN p_campaign as cLeft ON (cLeft.cid = p_campaigndata.cid) JOIN p_campaign_to_category as c2cLeft ON (c2cLeft.cid = p_campaigndata.cid) JOIN p_category as catLeft ON (catLeft.catid = c2cLeft.catid) JOIN p_campaign_to_category as c2cRight ON (c2cRight.catid = catLeft.catid) JOIN p_campaigndata as cdataRight ON (cdataRight.cid = c2cRight.cid) JOIN p_campaign as cRight ON (cdataRight.cid = cRight.cid) JOIN p_page as page ON (page.cid = cRight.cid) WHERE (p_campaigndata.cid = ) AND (page.pref_mainpage = 1) AND ((page.page_type = "campaign") OR (page.page_type = "store") OR (page.page_type = "product")) ORDER BY cname