Filtering Database Query with Multiple Checkboxes

Ok, makes sense so far, last thing, could you paste the code used in your checkbox group here, then I will have enough info to test on my end. I have only ever used the IN operator with similar data, in other words 1,2,3,4,5,6 etc, so just wondering how yours works with the SET of values, but will test it out when i see your checkbox group code.

1 Like

I had a similar scenario and took the decision to switch to a many-to-many table for the values of the checkboxes as that is much easier to work with and more flexible. Would you be able to make the same change?

The table structure would be something like


RecordID (int, index, ai)
ProductID (int)
FeatureID (int)

Then you can easily make the searches and other functions.

I cant make it work like that either, @sitestreet is right, best to change to a different database solution, then it’s easy.

I have too many tables and it will take me a long time if I have to take this new approach. Thank you anyway for your effort, I will continue to check on my side.

OK, but I was in the same position and got a colleague to write a script to convert all the fields which contained the piped data into separate records in the many-to-many so it wasn’t too big a job.

Ok, keep me posted for the script, I will see on my side if it is to execute it in my case, thx again

The script was completely custom to our requirements so there’s no point in posting it. However, it basically reads through the existing data, splits the fields which had multiple values (pipe separated) and then inserts the new records and includes the relationships. It took a bit of time to write (a few hours) but was very complex. However, when it ran it processed it all in seconds. I needed to do it this way as I was developing a new site where the old site data needed to be migrated so I had to do the migration several times. Hope that helps.

Noted, thx

1 Like

A post was split to a new topic: How to animate dynamic data?

Hi Teodor

I followed every step in your tutorial «Filtering Database Query with Multiple Checkboxes» and that works perfectly. Now my issue is that some records of my database have multiple categories. I separated those category-numbers with commas. Those records don’t show up when filtering with the checkboxes. Can you help me?

Thank you very much for your response.