Answer the question
In order to leave comments, you need to log in
How to select from js array in mysql using php?
Good afternoon, I'm doing a product filter, tell me how to make a selection in the database, where the param column has data of this type ["value1","value2","value3"]?
imput example:
<li class="" style="width: 85%;"><input name="param[]" type="checkbox" value="значение2" style="display:none" >значение2</li>
<li class="" style="width: 85%;"><input name="param[]" type="checkbox" value="значение3" style="display:none" >значение3</li>
Answer the question
In order to leave comments, you need to log in
The param column must not have "this type" of data.
We need to redo this horror so that the param column becomes a param table
1) https://dev.mysql.com/doc/refman/8.0/en/json.html#...
2) A not entirely correct alternative solution is to form a string based on the form data and make several conditions. For example, you need to apply only the first filter, and display everything for the other two:
Etc.
Of course, not manually writing everything, but somehow generating a request in a cycle
If HTML in one line
If HTML in different lines
SELECT * FROM `table` WHERE `field_html` LIKE '%value="значение1"%' OR `field_html` LIKE '%value="значение2"%' OR `field_html` LIKE '%value="значение3"%'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question