Boolean preview [solved]

Hi friends,

I believe a lot of webdev’s have faced this type of problem:

Running Dev WebServer on Win+XAMPP(same with WAMP)

Yii 1.1.1(believe this is not mainly Yii bug)

When fetching boolean attributes from DB instead of 1/0 it shows:



If any one has the same problem:

Solved by changing table attribute type from BIT (boolean) to INT.

Did you try TINYINT(1)? INT would be a huge waste of resources ;)

Yeah, this is true. I’ll try it too ;)

Its strange why BIT in one Server is 0/1 and in other like Japanese symbols(posted above)

Where exactly do you see these symbols? Usually it means somethin is interpreted as a character code (a.k.a. string) where it shouldn’t.

These are appearing in the default Yii Crud list/manage etc. (BIT’s were gathered from DB)

Also strange thing - some servers were showing 1/0 properly.

Since you’re using XAMPP, this may be a MySQL thing. MySQL handles bits a little weird (have to use b or 0b), I think it’s better using TinyInt. MySQL Bits

Thanks for sharing your opinions!

I’ll stick with TinyInt ;)