How to Insert update and delete checkbox datas in mysql database table.I need mysql query for all operations . I have only one database table for that operations. Thanks in advance
<input type="checkbox" name="sports" value="Cricket" /> Cricket
<input type="checkbox" name="sports" value="Football" />Football
<input type="checkbox" name="sports" value="Chess" />Chess
Database Structure
ID ,NAME, AGE ,SPORTS(checkbox need to save)
Like Shef said, you need those 3 tables
user,sport,user_sportuser
sport
user_sport
Generate the checkboxes with this php:
That will give you this HTML:
The update part
First query (Delete the values for the current $user_id):
Second query (Insert the new values for the current $user_id):
This can work for insert/update/delete