[Skip to main content](#vessel-content)

#   SQL error message on filters

##

- **[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")**
- [![jouwnaambord.nl's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile") Topic Author
- [ Offline](/forum/user/1188-jouwnaambord-nl)

Less More

- Posts: 515
- Thank you received: 22
-
-

10 years 3 months ago [\#246156](#246156) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  *[SQL error message on filters](/forum/45-filters-search/885710-sql-error-message-on-filters#246156 "-- HikaShop version -- : 2.6.3 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.5.9 -- Error-message(debug-mod must be tuned on) -- : 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 ':: DESC LIMIT 0, 8' at line 1 SQL=SELECT DISTINCT b.&#42; FROM #&#95;&#95;hikashop&#95;product&#95;category AS a LEFT JOIN #&#95;&#95;hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE b.product&#95;published=1 AND b.product&#95;type = 'main' AND a.category&#95;id IN (39,97,16,115,29,31,34,50,51,52,78,77,75,74,76,79,84,83,82,87,88,89,91,93,94,92,95,98,99,100,101,102,103,106,114,108,109,116,117,118,119,120,123,124,127,126,128,2) AND b.product&#95;quantity!=0 AND (b.product&#95;access = 'all' OR b.product&#95;access LIKE '%,9,%') ORDER BY 30:: DESC LIMIT 0, 8  I get several SQL errors on different Filters. Some work fine, others don't (see Error message above). Can't figure out what's wrong?")* was created by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")*

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.5.9
-- Error-message(debug-mod must be tuned on) -- : 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 ':: DESC LIMIT 0, 8' at line 1 SQL=SELECT DISTINCT b.* FROM #__hikashop_product_category AS a LEFT JOIN #__hikashop_product AS b ON a.product_id=b.product_id WHERE b.product_published=1 AND b.product_type = 'main' AND a.category_id IN (39,97,16,115,29,31,34,50,51,52,78,77,75,74,76,79,84,83,82,87,88,89,91,93,94,92,95,98,99,100,101,102,103,106,114,108,109,116,117,118,119,120,123,124,127,126,128,2) AND b.product_quantity!=0 AND (b.product_access = 'all' OR b.product_access LIKE '%,9,%') ORDER BY 30:: DESC LIMIT 0, 8

I get several SQL errors on different Filters. Some work fine, others don't (see Error message above). Can't figure out what's wrong?
[ ![Naamloos-1&#95;2016-07-23.jpg](/forum/attachment/32759) ](/forum/attachment/32759 "...2016-07-23.jpg")

- [ ![Naamloos-1&#95;2016-07-23.jpg](/forum/attachment/32759) ](/forum/attachment/32759 "...2016-07-23.jpg") [ ](/forum/attachment/32759?download=1 "...2016-07-23.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ1LWZpbHRlcnMtc2VhcmNoLzg4NTcxMC1zcWwtZXJyb3ItbWVzc2FnZS1vbi1maWx0ZXJzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86576
- Thank you received: 14320
-
-

10 years 3 months ago [\#246181](#246181) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[SQL error message on filters](/forum/45-filters-search/885710-sql-error-message-on-filters#246181 "-- HikaShop version -- : 2.6.3 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.5.9 -- Error-message(debug-mod must be tuned on) -- : 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 ':: DESC LIMIT 0, 8' at line 1 SQL=SELECT DISTINCT b.&#42; FROM #&#95;&#95;hikashop&#95;product&#95;category AS a LEFT JOIN #&#95;&#95;hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE b.product&#95;published=1 AND b.product&#95;type = 'main' AND a.category&#95;id IN (39,97,16,115,29,31,34,50,51,52,78,77,75,74,76,79,84,83,82,87,88,89,91,93,94,92,95,98,99,100,101,102,103,106,114,108,109,116,117,118,119,120,123,124,127,126,128,2) AND b.product&#95;quantity!=0 AND (b.product&#95;access = 'all' OR b.product&#95;access LIKE '%,9,%') ORDER BY 30:: DESC LIMIT 0, 8  I get several SQL errors on different Filters. Some work fine, others don't (see Error message above). Can't figure out what's wrong?")*

Hi,

Could you provide a link to the page with the filter so that we could reproduce the problem ?
Because we don't have the problem on our end with a filter configured like that.

What you could try changing is the code: Code:

if(!empty($case)){ $select2.=' ,'.$case.' as product_'.$type.'_normalized'; if($infos[1]=='lth'){ $order= ' ORDER BY product_'.$type.'_normalized*1 ASC'; }else{ $order= ' ORDER BY product_'.$type.'_normalized*1 DESC'; } }else{ if($infos[1]=='lth'){ $order= ' ORDER BY '.$type.' ASC'; }else{ $order= ' ORDER BY '.$type.' DESC'; } }

to: Code:

if(!empty($case)){ $select2.=' ,'.$case.' as product_'.$type.'_normalized'; if($infos[1]=='lth'){ $order= ' ORDER BY product_'.$type.'_normalized*1 ASC'; }elseif($infos[1]=='ftl'){ $order= ' ORDER BY product_'.$type.'_normalized*1 DESC'; } }else{ if($infos[1]=='lth'){ $order= ' ORDER BY '.$type.' ASC'; }elseif($infos[1]=='htl'){ $order= ' ORDER BY '.$type.' DESC'; } }

in the file administrator/components/com_hikashop/classes/filter.php

The following user(s) said Thank You: [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ1LWZpbHRlcnMtc2VhcmNoLzg4NTcxMC1zcWwtZXJyb3ItbWVzc2FnZS1vbi1maWx0ZXJzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")**
- [![jouwnaambord.nl's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile") Topic Author
- [ Offline](/forum/user/1188-jouwnaambord-nl)

Less More

- Posts: 515
- Thank you received: 22
-
-

10 years 3 months ago [\#246266](#246266) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  Replied by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")* on topic *[SQL error message on filters](/forum/45-filters-search/885710-sql-error-message-on-filters#246266 "-- HikaShop version -- : 2.6.3 -- Joomla version -- : 3.5.1 -- PHP version -- : 5.5.9 -- Error-message(debug-mod must be tuned on) -- : 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 ':: DESC LIMIT 0, 8' at line 1 SQL=SELECT DISTINCT b.&#42; FROM #&#95;&#95;hikashop&#95;product&#95;category AS a LEFT JOIN #&#95;&#95;hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE b.product&#95;published=1 AND b.product&#95;type = 'main' AND a.category&#95;id IN (39,97,16,115,29,31,34,50,51,52,78,77,75,74,76,79,84,83,82,87,88,89,91,93,94,92,95,98,99,100,101,102,103,106,114,108,109,116,117,118,119,120,123,124,127,126,128,2) AND b.product&#95;quantity!=0 AND (b.product&#95;access = 'all' OR b.product&#95;access LIKE '%,9,%') ORDER BY 30:: DESC LIMIT 0, 8  I get several SQL errors on different Filters. Some work fine, others don't (see Error message above). Can't figure out what's wrong?")*

Hi, Nicolas,

Thanks, this works fine!

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ1LWZpbHRlcnMtc2VhcmNoLzg4NTcxMC1zcWwtZXJyb3ItbWVzc2FnZS1vbi1maWx0ZXJzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.063 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
