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 pageCategory.category = 'Confirmations' AND pageView.pageCat
SELECT pageView.id as p_id, pageCategory.id as c_id, pageViews, lastModified FROM pageView, pageCategory WHERE raceId = AND pageCategory.category = 'Confirmations' AND pageView.pageCategoryId=pageCategory.id AND pageTitle = ''