What are the potential pitfalls of using a method that involves adding powers of 2 to determine checked checkboxes before storing data in a database?

One potential pitfall of using a method that involves adding powers of 2 to determine checked checkboxes before storing data in a database is that it can lead to confusion and potential errors when trying to retrieve and interpret the data later on. To solve this issue, a better approach would be to store the checkbox values individually in the database as boolean values (0 for unchecked, 1 for checked) for easier retrieval and manipulation.

// Example of storing checkbox values as boolean in the database
$checkbox1 = isset($_POST['checkbox1']) ? 1 : 0;
$checkbox2 = isset($_POST['checkbox2']) ? 1 : 0;

// Store the checkbox values in the database
$query = "INSERT INTO checkboxes (checkbox1, checkbox2) VALUES ('$checkbox1', '$checkbox2')";
// Execute the query