I want to have multiple checkbox values be stored into one field in a database. (Ex. 1, 24,56,100). I am wanting to know how I can make this happen, and how does PHP read thes
The perfect solution for this is task the creation of normalized table as commented by @OMG and @Michael.
But here is the answer for what you just asked
$ids = implode(", ", $_POST['ids']);
Store this in MySQL table. You can use LIKE command to query the table and use the explode to get back the ids in array.
$query = "SELECT * FROM WHERE ids LIKE '%,2, %'"; // get posts having id 2
$id = explode(", ", $result->ids);
- 热议问题