I have the two following tables
table A
| id | name |
| 1 | bob |
| 2 | jill |
| 3 | jojo |
Table A is displayed by using checkboxes.
On the first go, the user checks all three checkboxes so you get the result in table B.
table B
| table_a_id | table_c_id |
| 1 | 2 |
| 2 | 2 |
| 3 | 2 |
But the next time the user goes to edit, they UNCHECK ‘2’ so that it’s only:
1
3
How do I write my query (using either mySQL or php) so that TABLE B is updated to:
| table_a_id | table_c_id |
| 1 | 2 |
| 3 | 2 |
Or use InnoDB with a Foreign key
ON DELETE CASCADE, much simpler 🙂