MySQL Boolean type

  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3423
  • Loc: Richland, WA

Post 3+ Months Ago

Can I use the keyword TRUE/FALSE when insert into a Boolean field of a mysql database? From what I've read a Boolean field is just a TinyInt(1), so basicly Im wondering if using TRUE/FALSE in a mysql statment will be translated to 1/0.
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

TINYINT is synonymous with BOOL. PHP's auto-conversion should handle it just fine. Just don't forget that you'll have to cast back to boolean if you're looking for comparisons on result sets:

Code: [ Select ]
$row['boolCol'] = (boolean) $row['boolCol'];  
  2. $row['boolCol'] = (boolean) $row['boolCol'];  

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 25 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.