Uncaught Exception: SqlException

Message:
invalid query:- SELECT * FROM (
SELECT p.post_id, p.heading, p.link_rewrite, p.post_description, p.state_name as postStateName, p.city_name as postCityName, p.created_on, cn.country_name, s.state_name, c.city_name, ((MATCH(p.heading) AGAINST ('"Combined Laboratory and X-Ray Technician"' IN BOOLEAN MODE) * 100) + (MATCH(p.heading) AGAINST ('"Combined Laboratory and X"' IN BOOLEAN MODE) * 90) + (MATCH(p.heading) AGAINST ('"Combined Laboratory X"' IN BOOLEAN MODE) * 80) + (MATCH(p.heading) AGAINST ('+Combined +Laboratory X' IN BOOLEAN MODE) * 68.5) + (MATCH(p.heading) AGAINST ('+Combined Laboratory X' IN BOOLEAN MODE) * 67) + (MATCH(p.heading) AGAINST ('Combined Laboratory X' IN BOOLEAN MODE) * 65.5)) AS relevance, 0 as subNr
FROM posts p, countries cn, states s, cities c
WHERE p.post_id != 2071884
AND p.cat_id = 7
AND p.country_id = 2
AND c.city_name = 'FORT QU'APPELLE'
AND (MATCH(p.heading) AGAINST ('Combined Laboratory and X-Ray Technician' IN BOOLEAN MODE) > 0)
AND p.country_id = cn.country_id
AND p.state_id = s.state_id
AND p.city_id = c.city_id
AND p.is_active = 1

UNION

SELECT p.post_id, p.heading, p.link_rewrite, p.post_description, p.state_name as postStateName, p.city_name as postCityName, p.created_on, cn.country_name, s.state_name, c.city_name, ((MATCH(p.heading) AGAINST ('"Combined Laboratory and X-Ray Technician"' IN BOOLEAN MODE) * 100) + (MATCH(p.heading) AGAINST ('"Combined Laboratory and X"' IN BOOLEAN MODE) * 90) + (MATCH(p.heading) AGAINST ('"Combined Laboratory X"' IN BOOLEAN MODE) * 80) + (MATCH(p.heading) AGAINST ('+Combined +Laboratory X' IN BOOLEAN MODE) * 68.5) + (MATCH(p.heading) AGAINST ('+Combined Laboratory X' IN BOOLEAN MODE) * 67) + (MATCH(p.heading) AGAINST ('Combined Laboratory X' IN BOOLEAN MODE) * 65.5)) AS relevance, 1 as subNr
FROM posts p, countries cn, states s, cities c
WHERE p.post_id != 2071884
AND p.cat_id = 7
AND p.country_id = 2
AND s.state_name = 'Saskatchewan'
AND c.city_name != 'FORT QU'APPELLE'
AND (MATCH(p.heading) AGAINST ('Combined Laboratory and X-Ray Technician' IN BOOLEAN MODE) > 0)
AND p.country_id = cn.country_id
AND p.state_id = s.state_id
AND p.city_id = c.city_id
AND p.is_active = 1

UNION

SELECT p.post_id, p.heading, p.link_rewrite, p.post_description, p.state_name as postStateName, p.city_name as postCityName, p.created_on, cn.country_name, s.state_name, c.city_name, ((MATCH(p.heading) AGAINST ('"Combined Laboratory and X-Ray Technician"' IN BOOLEAN MODE) * 100) + (MATCH(p.heading) AGAINST ('"Combined Laboratory and X"' IN BOOLEAN MODE) * 90) + (MATCH(p.heading) AGAINST ('"Combined Laboratory X"' IN BOOLEAN MODE) * 80) + (MATCH(p.heading) AGAINST ('+Combined +Laboratory X' IN BOOLEAN MODE) * 68.5) + (MATCH(p.heading) AGAINST ('+Combined Laboratory X' IN BOOLEAN MODE) * 67) + (MATCH(p.heading) AGAINST ('Combined Laboratory X' IN BOOLEAN MODE) * 65.5)) AS relevance, 2 as subNr
FROM posts p, countries cn, states s, cities c
WHERE p.post_id != 2071884
AND p.cat_id = 7
AND p.country_id = 2
AND c.city_name = 'FORT QU'APPELLE'
AND p.country_id = cn.country_id
AND p.state_id = s.state_id
AND p.city_id = c.city_id
AND p.is_active = 1

UNION

SELECT p.post_id, p.heading, p.link_rewrite, p.post_description, p.state_name as postStateName, p.city_name as postCityName, p.created_on, cn.country_name, s.state_name, c.city_name, ((MATCH(p.heading) AGAINST ('"Combined Laboratory and X-Ray Technician"' IN BOOLEAN MODE) * 100) + (MATCH(p.heading) AGAINST ('"Combined Laboratory and X"' IN BOOLEAN MODE) * 90) + (MATCH(p.heading) AGAINST ('"Combined Laboratory X"' IN BOOLEAN MODE) * 80) + (MATCH(p.heading) AGAINST ('+Combined +Laboratory X' IN BOOLEAN MODE) * 68.5) + (MATCH(p.heading) AGAINST ('+Combined Laboratory X' IN BOOLEAN MODE) * 67) + (MATCH(p.heading) AGAINST ('Combined Laboratory X' IN BOOLEAN MODE) * 65.5)) AS relevance, 3 as subNr
FROM posts p, countries cn, states s, cities c
WHERE p.post_id != 2071884
AND p.cat_id = 7
AND p.country_id = 2
AND s.state_name = 'Saskatchewan'
AND c.city_name != 'FORT QU'APPELLE'
AND p.country_id = cn.country_id
AND p.state_id = s.state_id
AND p.city_id = c.city_id
AND p.is_active = 1
) similarJobs
GROUP BY post_id
ORDER BY subNr, relevance DESC, CASE WHEN heading LIKE 'Combined%' THEN 1 ELSE 2 END

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 'APPELLE'
AND (MATCH(p.heading) AGAINST ('Combined Laboratory and X-Ray T' at line 7
Created in file /home/topjobst/public_html/careerlodge/GL/lib/database/SqlDatabaseManager.class.php on line 155.

Stack Trace:
#0 /home/topjobst/public_html/careerlodge/appcode/datamanager/JobDataManager.class.php(740): SqlDatabaseManager->executeQuery('SELECT * FROM (...')
#1 /home/topjobst/public_html/careerlodge/protected/controller/listings.php(332): JobDataManager->getSimilarJobsByRelevancy('2071884', Array, 'Combined Labora...', 'Combined Labora...')
#2 [internal function]: listings->detail('2071884-combine...')
#3 /home/topjobst/public_html/careerlodge/GL/lib/RegisterCallback.class.php(8): call_user_func_array(Array, Array)
#4 /home/topjobst/public_html/careerlodge/GL/lib/Application.class.php(47): RegisterCallback::register(Object(listings), 'detail', Array)
#5 /home/topjobst/public_html/careerlodge/index.php(12): Application::run(Object(HttpRequest))
#6 {main}
5.
In file /home/topjobst/public_html/careerlodge/appcode/datamanager/JobDataManager.class.php line 740.
Method: SqlDatabaseManager->executeQuery([$query FILTERED])
4.
In file /home/topjobst/public_html/careerlodge/protected/controller/listings.php line 332.
Method: JobDataManager->getSimilarJobsByRelevancy([$current_post_id FILTERED], [$jd FILTERED], [$jobTitleClearString FILTERED], [$jobTitleClearCommonWords FILTERED])
3.
In file unknown line unknown.
Method: listings->detail([$jobIdStr FILTERED])
2.
In file /home/topjobst/public_html/careerlodge/GL/lib/RegisterCallback.class.php line 8.
Method: call_user_func_array([$function_name FILTERED], [$parameters FILTERED])
1.
In file /home/topjobst/public_html/careerlodge/GL/lib/Application.class.php line 47.
Method: RegisterCallback::register([$class FILTERED], [$funcName FILTERED], [$args FILTERED])
0.
In file /home/topjobst/public_html/careerlodge/index.php line 12.
Method: Application::run([$request FILTERED])