Exception

SQLSTATE[42000]: Syntax error or access violation: 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 `dateto` <= ) OR (`datefrom` >= AND `dateto` <= )) ORDER BY `datefrom` DESC' at line 1

Error triggered in line 119 of /var/www/vhosts/intermarketingonline.com/httpdocs/application/models/eventsModel.php

#0 /var/www/vhosts/intermarketingonline.com/httpdocs/application/models/eventsModel.php(119): PDOStatement->execute()
#1 /var/www/vhosts/intermarketingonline.com/httpdocs/application/controllers/eventsController.php(68): eventsModel->getEvents('past', 'www.intermarket...', 'contact', '', 1)
#2 /var/www/vhosts/intermarketingonline.com/httpdocs/application/controllers/eventsController.php(19): eventsController->sort('past', 'www.intermarket...', 'contact', '', 1)
#3 [internal function]: eventsController->__call('past', Array)
#4 [internal function]: eventsController->past('www.intermarket...', 'contact')
#5 /var/www/vhosts/intermarketingonline.com/httpdocs/system/core/router.php(100): call_user_func_array(Array, Array)
#6 /var/www/vhosts/intermarketingonline.com/httpdocs/system/core/router.php(20): router->route()
#7 /var/www/vhosts/intermarketingonline.com/httpdocs/system/core/bootstrap.php(91): router->__Construct()
#8 /var/www/vhosts/intermarketingonline.com/httpdocs/system/core/bootstrap.php(25): bootstrap->router()
#9 /var/www/vhosts/intermarketingonline.com/httpdocs/index.php(39): bootstrap->__Construct()
#10 {main}