stonelord Posted June 24, 2008 Share Posted June 24, 2008 Hi, I have been tryoing to read but I can't seem to find a good answer. What is the best data type in mysql to use for a field in my database that I want to receive a "yes" or "no" answer? or "true" or "false"? I read that 'Enum' may be one of them because I don't see 'Boolean'!!! Please help, thank you Link to comment https://forums.phpfreaks.com/topic/111613-true-or-false-data-type/ Share on other sites More sharing options...
gijew Posted June 24, 2008 Share Posted June 24, 2008 If I want true or false I usually use an INT field type and set it to 0 (false) or 1 (true). Enum works as well because it allows options so you could just put in ('true','false') as the defaults. Link to comment https://forums.phpfreaks.com/topic/111613-true-or-false-data-type/#findComment-572901 Share on other sites More sharing options...
clearstatcache Posted June 24, 2008 Share Posted June 24, 2008 You may use tinyint length = 1 Link to comment https://forums.phpfreaks.com/topic/111613-true-or-false-data-type/#findComment-572903 Share on other sites More sharing options...
clearstatcache Posted June 24, 2008 Share Posted June 24, 2008 You may use tinyint length = 1. 1 for true and 0 for false Link to comment https://forums.phpfreaks.com/topic/111613-true-or-false-data-type/#findComment-572906 Share on other sites More sharing options...
dannyb785 Posted June 24, 2008 Share Posted June 24, 2008 ^ and ^^ ditto. Tinyint is what i do.or maybe varchar with length 1(but I dont do that, I dunno which takes up more space) Link to comment https://forums.phpfreaks.com/topic/111613-true-or-false-data-type/#findComment-572909 Share on other sites More sharing options...
fenway Posted June 24, 2008 Share Posted June 24, 2008 There's a BIT field, too. Link to comment https://forums.phpfreaks.com/topic/111613-true-or-false-data-type/#findComment-573106 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.