after boolean becomes tinyint(1)

Codes here !

Moderators: macek, egami, gesf

Post Reply
MeroD
New php-forum User
New php-forum User
Posts: 53
Joined: Wed Oct 10, 2012 12:14 am

Re: after boolean becomes tinyint(1)

Post by MeroD » Wed Nov 07, 2012 3:49 am

BOOLEAN is an alias to TINYINT(1)

Zero is false, anything else is true. Your function will return 0 or 1, which will get transformed into a string--so in PHP you have the strings '0' and '1'... If you need to compare with a zero use ===

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: after boolean becomes tinyint(1)

Post by seandisanti » Tue Nov 13, 2012 2:04 pm

you can also use bit for boolean values. it's mostly a matter of preference, but if you have multiple boolean fields, they are stored in a single byte (up to 8 of them) rather than requiring a byte each as with tinyint.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests