bosecom Developer Od United Kingdom Użytkownik od maj 2023 bosecom 11 sty 2024 20:35 SELECT * FROM lc_products where lc_products.quantity > 0 this works fine SELECT * FROM lc_products WHERE lc_products.keywords LIKE '%test%' AND lc_products.quantity > 0 this does not the function returns an empty array, using the basic: database::query($query); all help appreciated
dodo Moderator Od Lithuania Użytkownik od mar 2016 dodo 12 sty 2024 11:33 There is a typo in lc_product.keywords. Should be lc_products.keywords And if you are not using JOIN then your query could be like this instead: WHERE keywords LIKE '%test%' AND quantity > 0``` Do you want to be more specific what are you trying to do with this query in the product page? As this is a separate problem from the first one.
bosecom Developer Od United Kingdom Użytkownik od maj 2023 bosecom 12 sty 2024 12:51 Received by Show Products Object { matchedProducts: [], numberOfResults: 0 } search:810:13 No products found or products is not an array still shows an empty array using LIKE tried with: SELECT * FROM lc_products WHERE keywords LIKE '%acer%' AND lc_products.quantity > 0 literally no response when using LIKE, if i run other queries without LIKE it works fine.
tim Founder Od Sweden Użytkownik od maj 2013 tim 12 sty 2024 14:05 I don't see any errors in your query. What happens if you run the same query in phpMyAdmin? What happens if you skip the quantity condition? You might want to use find_in_set() instead of like for matching a value in a set.
bosecom Developer Od United Kingdom Użytkownik od maj 2023 bosecom 12 sty 2024 14:07 It works absolutely fine in phpmyadmin and mysql and returns the correct 28 matches, however if i run it from the script the query produces an empty array What happens if you skip the quantity condition? same result if you want to anydesk to view what i am doing let me know i can screenshare and show you exactly whats going on
bosecom Developer Od United Kingdom Użytkownik od maj 2023 bosecom 17 sty 2024 16:32 Issue resolved, it was related to max execution time being set to 600, in mysql 8.2 the time is in milliseconds not seconds.