Jump to content

data type bit


es131245

Recommended Posts

ive got some "private" parts of the site which i want to limit access by SQL table (like licence limited files and MODERATOR panels)so USER table looks likeid login pass share moderator grantedUser1 root pass 1 1 12 friends code 1 0 13 guest la-la 0 0 0data type of the parts is BITi wanted to make a 0 a default and 1 is access granted but now i see that for 1 i get SOH symbol and for 0 i get � and NULL works for NULLive tried to set a boolean value in phpa i get true for 1 & 0 and false for NULLi dont want to use TINYINT because its actualy 256 and just dont want to...

Link to comment
Share on other sites

for 1 i get SOH symbol and for 0 i get � and NULL works for NULL
If a bit field is printing characters then for whatever reason it's being interpreted as an ASCII character instead of a number.
ive tried to set a boolean value in phpa i get true for 1 & 0 and false for NULL
That may be due to how you're assigning the value in PHP.
i dont want to use TINYINT because its actualy 256 and just dont want to...
I'm not sure what that means, but I always use unsigned tinyint fields of length 1 for these things. But if you just don't want to, then you don't want to.
Link to comment
Share on other sites

here is all values ive gotmta is mysql_fetch_assoc['share']b is (boolean)mysql_fetch_assoc['share']1 mta=;b=1mta isset B isset mta =0 b=1 mta=true b=true0 mta=;b=1mta isset B isset mta =0 b=1 mta=true b=trueNULLmta = ; b =mta NOT set B issetmta=0 b=0mta=false b=false

Link to comment
Share on other sites

$permit=$mysql_fetch_assoc['permit']; $perm=$mysql_fetch_assoc['perm'];print($permit.'=');print((int)$permit.'<br />');print($perm.'=');print((int)$perm.'<br />');die();=0=0so tinyint is the only way&&USE mysql;SHOW COLUMNS user;USE $sitedb;ALTER TABLE $tablename MODIFY COLUMN $permit enum('N','Y');

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...