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

#   SQL 1064 syntax error when updating related products via a mass action

##

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

Less More

- Posts: 20
- Thank you received: 1
-
-
- [](https://starwoodsystems.com/)
-

5 years 5 months ago [\#333317](#333317) by [speru](/forum/user/26914-speru "View speru's Profile")  *[SQL 1064 syntax error when updating related products via a mass action](/forum/44-mass-actions/902742-sql-1064-syntax-error-when-updating-related-products-via-a-mass-action#333317 "-- HikaShop version -- : 4.4.1 -- Joomla version -- : 3.9.26 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Firefox 90.0b3 -- Error-message(debug-mod must be tuned on) -- : An error has occurred.  1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(4564,5765,'related'),(4565,5765,'related'),(4566,5765,'related'),(4567,5765,...' at line 1  File : plugins/hikashop/massaction&#95;product/massaction&#95;product.php function : onProcessProductMassActionupdateRelateds  Line 1068 to Line 1075  This leads to a problem on the 2nd and subsequent loops, as $deleteQuery is overwritten on each loop. The fix is to replace the lines 1072 and 1073 with  The same problem occurs on lines 1088 and 1089 with the variable being overwritten.")* was created by *[speru](/forum/user/26914-speru "View speru's Profile")*

-- HikaShop version -- : 4.4.1
-- Joomla version -- : 3.9.26
-- PHP version -- : 7.4
-- Browser(s) name and version -- : Firefox 90.0b3
-- Error-message(debug-mod must be tuned on) -- : An error has occurred.

1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(4564,5765,'related'),(4565,5765,'related'),(4566,5765,'related'),(4567,5765,...' at line 1

File : plugins/hikashop/massaction_product/massaction_product.php
function : onProcessProductMassActionupdateRelateds

Line 1068 to Line 1075 Code:

$c = ceil((int)count($deleteIds) / $max); for($i = 0; $i &lt; $c; $i++){ $offset = $max * $i; $id = array_slice($deleteIds, $offset, $max); $deleteQuery = $deleteQuery . implode(',',$id) .')'; $db-&gt;setQuery($deleteQuery); $db-&gt;execute(); }

This leads to a problem on the 2nd and subsequent loops, as $deleteQuery is overwritten on each loop.
The fix is to replace the lines 1072 and 1073 with Code:

$dq = $deleteQuery . implode(',',$id) .')'; $db-&gt;setQuery($dq);

The same problem occurs on lines 1088 and 1089 with the Code:

$insertQuery

variable being overwritten.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDI3NDItc3FsLTEwNjQtc3ludGF4LWVycm9yLXdoZW4tdXBkYXRpbmctcmVsYXRlZC1wcm9kdWN0cy12aWEtYS1tYXNzLWFjdGlvbj90bXBsPW1hcmtkb3du) 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")
- [ Online](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

5 years 5 months ago [\#333322](#333322) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[SQL 1064 syntax error when updating related products via a mass action](/forum/44-mass-actions/902742-sql-1064-syntax-error-when-updating-related-products-via-a-mass-action#333322 "-- HikaShop version -- : 4.4.1 -- Joomla version -- : 3.9.26 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Firefox 90.0b3 -- Error-message(debug-mod must be tuned on) -- : An error has occurred.  1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(4564,5765,'related'),(4565,5765,'related'),(4566,5765,'related'),(4567,5765,...' at line 1  File : plugins/hikashop/massaction&#95;product/massaction&#95;product.php function : onProcessProductMassActionupdateRelateds  Line 1068 to Line 1075  This leads to a problem on the 2nd and subsequent loops, as $deleteQuery is overwritten on each loop. The fix is to replace the lines 1072 and 1073 with  The same problem occurs on lines 1088 and 1089 with the variable being overwritten.")*

Hi,

Thanks for the feedback !
We've added the fix on our end.

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

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

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

Less More

- Posts: 285
- Thank you received: 42
-
-

5 years 4 months ago [\#334577](#334577) by [oxido](/forum/user/29793-oxido "View oxido's Profile")  Replied by *[oxido](/forum/user/29793-oxido "View oxido's Profile")* on topic *[SQL 1064 syntax error when updating related products via a mass action](/forum/44-mass-actions/902742-sql-1064-syntax-error-when-updating-related-products-via-a-mass-action#334577 "-- HikaShop version -- : 4.4.1 -- Joomla version -- : 3.9.26 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Firefox 90.0b3 -- Error-message(debug-mod must be tuned on) -- : An error has occurred.  1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(4564,5765,'related'),(4565,5765,'related'),(4566,5765,'related'),(4567,5765,...' at line 1  File : plugins/hikashop/massaction&#95;product/massaction&#95;product.php function : onProcessProductMassActionupdateRelateds  Line 1068 to Line 1075  This leads to a problem on the 2nd and subsequent loops, as $deleteQuery is overwritten on each loop. The fix is to replace the lines 1072 and 1073 with  The same problem occurs on lines 1088 and 1089 with the variable being overwritten.")*

I get the same error from time to time.
It happend like this:
Filter settings: Submit on click= ON , Deletable filter=ON, Dynamic display=ON
I check 1 filter witch show only 1 product, not all the time but after I delete the filter, no product it's show, and if i refresh that page I get this error Code:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ) ORDER BY a.ordering ASC LIMIT 0, 21' at line 1

That fix apply for this filter bug also?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDI3NDItc3FsLTEwNjQtc3ludGF4LWVycm9yLXdoZW4tdXBkYXRpbmctcmVsYXRlZC1wcm9kdWN0cy12aWEtYS1tYXNzLWFjdGlvbj90bXBsPW1hcmtkb3du) 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")
- [ Online](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

5 years 4 months ago [\#334579](#334579) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[SQL 1064 syntax error when updating related products via a mass action](/forum/44-mass-actions/902742-sql-1064-syntax-error-when-updating-related-products-via-a-mass-action#334579 "-- HikaShop version -- : 4.4.1 -- Joomla version -- : 3.9.26 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Firefox 90.0b3 -- Error-message(debug-mod must be tuned on) -- : An error has occurred.  1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(4564,5765,'related'),(4565,5765,'related'),(4566,5765,'related'),(4567,5765,...' at line 1  File : plugins/hikashop/massaction&#95;product/massaction&#95;product.php function : onProcessProductMassActionupdateRelateds  Line 1068 to Line 1075  This leads to a problem on the 2nd and subsequent loops, as $deleteQuery is overwritten on each loop. The fix is to replace the lines 1072 and 1073 with  The same problem occurs on lines 1088 and 1089 with the variable being overwritten.")*

Hi,

No. The fix here is for the mass action system.
From what you say the issue you have comes from the filter system.
Also, while the part "1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near" of the error message is the same, it just means that there is an error somewhere in a MySQL query.
So even if that part of the message is the same, it doesn't mean that the error is linked at all besides the fact that both errors com from a MySQL query.

In your case, we'll need that you :
- activate the "error reporting" and "debug mode" settings of the Joomla configuration
- do that modification: [ www.hikashop.com/support/forum/install-u...ror-1064.html#326783](https://www.hikashop.com/support/forum/install-update/901387-i-can-t-access-hikashop-having-error-1064.html#326783)
- reproduce the error. That should give you an error message with the full MySQL query and the location of the error. Please provide all the information.
- provide also a screenshot of the settings of your filter so that we can better understand the situation.

That will allow us to understand what's going on and create a patch to fix the problem.

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

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

Less More

- Posts: 285
- Thank you received: 42
-
-

5 years 4 months ago [\#334599](#334599) by [oxido](/forum/user/29793-oxido "View oxido's Profile")  Replied by *[oxido](/forum/user/29793-oxido "View oxido's Profile")* on topic *[SQL 1064 syntax error when updating related products via a mass action](/forum/44-mass-actions/902742-sql-1064-syntax-error-when-updating-related-products-via-a-mass-action#334599 "-- HikaShop version -- : 4.4.1 -- Joomla version -- : 3.9.26 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Firefox 90.0b3 -- Error-message(debug-mod must be tuned on) -- : An error has occurred.  1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(4564,5765,'related'),(4565,5765,'related'),(4566,5765,'related'),(4567,5765,...' at line 1  File : plugins/hikashop/massaction&#95;product/massaction&#95;product.php function : onProcessProductMassActionupdateRelateds  Line 1068 to Line 1075  This leads to a problem on the 2nd and subsequent loops, as $deleteQuery is overwritten on each loop. The fix is to replace the lines 1072 and 1073 with  The same problem occurs on lines 1088 and 1089 with the variable being overwritten.")*

Code:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ) ORDER BY a.ordering ASC LIMIT 0, 21' at line 1 SELECT DISTINCT b.* FROM wbj9o_hikashop_product_category AS a LEFT JOIN wbj9o_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 (28)) AND ((b.product_access = 'all' OR b.product_access LIKE '%,9,%')) AND ( () ) ORDER BY a.ordering ASC LIMIT 0, 21

Call stack
\# Function Location
1 () JROOT/libraries/joomla/database/driver/mysqli.php:668
2 JDatabaseDriverMysqli-&gt;execute() JROOT/libraries/joomla/database/driver.php:1701
3 JDatabaseDriver-&gt;loadObjectList() JROOT/components/com_hikashop/views/product/view.html.php:982
4 ProductViewProduct-&gt;listing() JROOT/components/com_hikashop/views/product/view.html.php:28
5 ProductViewProduct-&gt;display() JROOT/libraries/src/MVC/Controller/BaseController.php:672
6 Joomla\CMS\MVC\Controller\BaseController-&gt;display() JROOT/administrator/components/com_hikashop/helpers/helper.php:2302
7 hikashopController-&gt;display() JROOT/components/com_hikashop/controllers/product.php:46
8 productController-&gt;listing() JROOT/libraries/src/MVC/Controller/BaseController.php:710
9 Joomla\CMS\MVC\Controller\BaseController-&gt;execute() JROOT/administrator/components/com_hikashop/helpers/helper.php:2280
10 hikashopController-&gt;execute() JROOT/components/com_hikashop/hikashop.php:92
11 require_once() JROOT/libraries/src/Component/ComponentHelper.php:402
12 Joomla\CMS\Component\ComponentHelper::executeComponent() JROOT/libraries/src/Component/ComponentHelper.php:377
13 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:194
14 Joomla\CMS\Application\SiteApplication-&gt;dispatch() JROOT/libraries/src/Application/SiteApplication.php:233
15 Joomla\CMS\Application\SiteApplication-&gt;doExecute() JROOT/libraries/src/Application/CMSApplication.php:203
16 Joomla\CMS\Application\CMSApplication-&gt;execute() JROOT/index.php:49

So I check the filter, uncheck and refresh the page.
At the end of gif 2, I refresh the page to see the error.

Let me know if you need more info.
I use the last version of Joomla and last of Hikashop Bussines

- [ ![age&#95;filter&#95;2021-07-22.jpeg](/forum/attachment/53289) ](/forum/attachment/53289 "...021-07-22.jpeg") [ ](/forum/attachment/53289?download=1 "...021-07-22.jpeg")
- [ ![module&#95;age&#95;2021-07-22.jpeg](/forum/attachment/53290) ](/forum/attachment/53290 "...021-07-22.jpeg") [ ](/forum/attachment/53290?download=1 "...021-07-22.jpeg")
- [ ![1.gif](/forum/attachment/53291) ](/forum/attachment/53291 "1.gif") [ ](/forum/attachment/53291?download=1 "1.gif")
- [ ![2.gif](/forum/attachment/53292) ](/forum/attachment/53292 "2.gif") [ ](/forum/attachment/53292?download=1 "2.gif")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDI3NDItc3FsLTEwNjQtc3ludGF4LWVycm9yLXdoZW4tdXBkYXRpbmctcmVsYXRlZC1wcm9kdWN0cy12aWEtYS1tYXNzLWFjdGlvbj90bXBsPW1hcmtkb3du) 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")
- [ Online](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

5 years 4 months ago [\#334607](#334607) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[SQL 1064 syntax error when updating related products via a mass action](/forum/44-mass-actions/902742-sql-1064-syntax-error-when-updating-related-products-via-a-mass-action#334607 "-- HikaShop version -- : 4.4.1 -- Joomla version -- : 3.9.26 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Firefox 90.0b3 -- Error-message(debug-mod must be tuned on) -- : An error has occurred.  1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(4564,5765,'related'),(4565,5765,'related'),(4566,5765,'related'),(4567,5765,...' at line 1  File : plugins/hikashop/massaction&#95;product/massaction&#95;product.php function : onProcessProductMassActionupdateRelateds  Line 1068 to Line 1075  This leads to a problem on the 2nd and subsequent loops, as $deleteQuery is overwritten on each loop. The fix is to replace the lines 1072 and 1073 with  The same problem occurs on lines 1088 and 1089 with the variable being overwritten.")*

Hi,

Thank you for the detailed answer. That's great !
I've made a patch on our end to fix the issue.
Download again the install package of HikaShop on our website and install it on your website. It will add the patch and it should then hopefully work.

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDI3NDItc3FsLTEwNjQtc3ludGF4LWVycm9yLXdoZW4tdXBkYXRpbmctcmVsYXRlZC1wcm9kdWN0cy12aWEtYS1tYXNzLWFjdGlvbj90bXBsPW1hcmtkb3du) 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.101 seconds

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