php - It's better to use BIT or BOOLEAN fro YES/NOT values in MySQL? -



php - It's better to use BIT or BOOLEAN fro YES/NOT values in MySQL? -

1) in table have column set privileges of users.

i want have flag 1/0 (yes/not,true/false , on..) privileges (for example: if user admin or mod...).

i searched lot, i'm still confused differences boolean , bit in terms of resources requests dbms. better?

i found lot of question of pasted years, i'd have fresh answer, in case it's changed/improved.

2) question...

i tryied utilize both of these types , saw boolean, it's easy check if value true or false, haven't figured out how see value of variable bit. i'm database coloumn set values 1 or 0, echo of bit variable, nil shown.

so, how can see value of bit (i need utilize 1 or 0).

thank in advice!

use tinyint(1). it's what's commonly used boolean values. bear in mind though allows values beyond 1 , 0 sake of consistency i'd suggest using keywords true , false when inserting info in reflect 1 , 0.

bool , boolean synonyms tinyint(1). bit on other hand used synonym tinyint(1) before version 5.0.3.

php mysql

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -