2

We have encountered a big problem with Magento search since this morning. When some (not all) terms are searched for we get an SQL error:

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 '' at line 1

I don't know if this is relevant but the error only seems to occur when a term which is from one of the products added yesterday (the SKU, part of the product name etc.).

I've tried reindexing but it's made no difference.

The trace reads:

Trace:
#0 /home/cloudpanel/htdocs/www.oursite.co.uk/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/cloudpanel/htdocs/www.oursite.co.uk/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/cloudpanel/htdocs/www.oursite.co.uk/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/cloudpanel/htdocs/www.oursite.co.uk/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('select count(*)...', Array)
#4 /home/cloudpanel/htdocs/www.oursite.co.uk/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('select count(*)...', Array)
#5 /home/cloudpanel/htdocs/www.oursite.co.uk/lib/Zend/Db/Adapter/Abstract.php(825): Varien_Db_Adapter_Pdo_Mysql->query('select count(*)...', Array)
#6 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/local/Mage/Catalog/Helper/Product.php(493): Zend_Db_Adapter_Abstract->fetchOne('select count(*)...')
#7 /home/cloudpanel/htdocs/www.oursite.co.uk/app/design/frontend/bdc/responsive/template/catalog/product/list.phtml(127): Mage_Catalog_Helper_Product->getTierPriceCount(Object(Mage_Catalog_Model_Product))
#8 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Template.php(241): include('/home/cloudpane...')
#9 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/bdc/re...')
#10 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#11 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#12 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#13 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('search_result_l...', true)
#14 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/CatalogSearch/Block/Result.php(161): Mage_Core_Block_Abstract->getChildHtml('search_result_l...')
#15 /home/cloudpanel/htdocs/www.oursite.co.uk/app/design/frontend/bdc/responsive/template/catalogsearch/result.phtml(82): Mage_CatalogSearch_Block_Result->getProductListHtml()
#16 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Template.php(241): include('/home/cloudpane...')
#17 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/bdc/re...')
#18 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#19 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#20 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#21 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#22 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#23 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#24 /home/cloudpanel/htdocs/www.oursite.co.uk/app/design/frontend/bdc/responsive/template/page/2columns-left.phtml(50): Mage_Core_Block_Abstract->getChildHtml('content')
#25 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Template.php(241): include('/home/cloudpane...')
#26 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/bdc/re...')
#27 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#28 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#29 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#30 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/local/ClickTale/Integration/Model/Layout.php(49): Mage_Core_Model_Layout->getOutput()
#31 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/local/Mage/Core/Controller/Varien/Action.php(389): ClickTale_Integration_Model_Layout->getOutput()
#32 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/local/BDC/SearchRedirects/controllers/ResultController.php(81): Mage_Core_Controller_Varien_Action->renderLayout()
#33 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/local/Mage/Core/Controller/Varien/Action.php(417): BDC_SearchRedirects_ResultController->indexAction()
#34 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#35 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#36 /home/cloudpanel/htdocs/www.oursite.co.uk/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#37 /home/cloudpanel/htdocs/www.oursite.co.uk/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#38 /home/cloudpanel/htdocs/www.oursite.co.uk/index.php(100): Mage::run('base', 'website')
#39 {main}

If anyone could point us in the right direction it'd be a massive help.

2
  • If its nothing you have changed it could be a problem with the MYSQL service on your environment, are you with a dedicated hosting company? Is this something they can look into? Maybe the service requires a restart.
    – Muzza
    Commented Aug 6, 2015 at 11:24
  • You need to get the SQL being generated, either log it in mysql for a few seconds or do one of these: magentotherightway.com/#debugging-database-queries
    – Richard
    Commented Aug 6, 2015 at 15:38

1 Answer 1

0

Thanks for the suggestions.

We tried restarting SQL but that had no effect.

What we did find was that the products had been added incorrectly; the associated products had been given the visibility 'Catalog/Search' rather than 'Not Visible Individually'. It was a new-starter who added them.

So it was as simple as that. Thanks for the responses though!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.