DEV Community

Discussion on: Storing booleans in mySql database as integers/boolean/text for true and false?

 
dgloriaweb profile image
dgloriaweb • Edited

So you've developed a validation on frontend and backend as well that filters out every typo and other words than true/false? Not being mean here, but that's essential if you choose that road.

Thread Thread
 
marissab profile image
Marissa B

There's no need to do that if you're checking on a situation like whether a checkbox is checked.

If your process involves a user manually entering the words true/false/0/1/etc and you're not validating it before using it on the backend.... That's a big problem for introducing weird issues.

Flipping whatever the checkbox state is into the words true/false to save somewhere should be one line in most languages.

Thread Thread
 
dgloriaweb profile image
dgloriaweb

That's perfectly true. Was overthinking it. :)