Maybe I am having a mind block here but I cant seem to get an AND clause to work properly in this query. I only want to return results where tbl_mod_Lessons.Approved = 1.
$sql = "SELECT *,
(SELECT AVG(intRating) FROM tbl_mod_LessonReviews LR WHERE LR.intLessonID = LS.intLessonID) rating,
(SELECT strContentArea FROM tbl_mod_ContentAreas CA WHERE CA.intCAID = LS.intContentAreaID) strContentArea
FROM tbl_mod_Lessons LS
WHERE
(LS.strTitle LIKE $search_string) OR
(LS.strStandards LIKE $search_string) OR
(LS.strDescription LIKE $search_string) OR
(LS.strActivities LIKE $search_string) OR
EXISTS(SELECT strContentArea FROM tbl_mod_ContentAreas CA WHERE CA.intCAID = LS.intContentAreaID AND (CA.strContentArea LIKE $search_string))
AND (LS.Approved = 1)
ORDER BY ".$pager->getOrder("LS.intLessonID DESC")."
LIMIT ".$pager->PageLimits();
as you can see iv tried to add it in, this does not break the query but its returning results where Approved = 0 .
Try the one below. I added some brackets around your OR clauses.