Search-friendly way to store checkbox values in MySQL?

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2009-08-29T23:14:30Z Indexed on 2010/06/13 9:02 UTC
Read the original article Hit count: 195

Filed under:
|
|

What is a search-friendly way to store checkbox values in the database?

Currently, checkboxes are processed as an array and values are separated by a ";"

As such:

<input type="checkbox" name="frequency[]" value="Daily"/> Daily
<input type="checkbox" name="frequency[]" value="Weekly"/> Weekly
<input type="checkbox" name="frequency[]" value="Monthly"/> Monthly

The PHP backend runs implode(';', $frequency) and adds the string to the database.

This works fine but it's a nightmare when it comes to searching.

Is there a better way to approach this?

© Stack Overflow or respective owner

Related posts about database

Related posts about search