I made table with some Boolean fields.
CREATE TABLE PM_ADMIN_LIST( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, username VARCHAR(250) NOT NULL, password VARCHAR(250) NOT NULL, mail VARCHAR(250) NOT NULL, added_time INT, super_admin VARCHAR(250) NOT NULL, last_time INT, last_ip VARCHAR(250), see_user_per BOOLEAN DEFAULT FALSE, change_user_per BOOLEAN DEFAULT FALSE, see_people_per BOOLEAN DEFAULT FALSE, change_people_per BOOLEAN DEFAULT FALSE, add_people_per BOOLEAN DEFAULT FALSE, remove_people_per BOOLEAN DEFAULT FALSE, see_album_per BOOLEAN DEFAULT FALSE, add_album_per BOOLEAN DEFAULT FALSE, change_album_per BOOLEAN DEFAULT FALSE, remove_album_per BOOLEAN DEFAULT FALSE, see_music_per BOOLEAN DEFAULT FALSE, add_music_per BOOLEAN DEFAULT FALSE, change_music_per BOOLEAN DEFAULT FALSE, remove_music_per BOOLEAN DEFAULT FALSE, admin_per BOOLEAN DEFAULT FALSE, yahoo_per BOOLEAN DEFAULT FALSE, status_per BOOLEAN DEFAULT FALSE, pm_per BOOLEAN DEFAULT FALSE, ip_blocking_per BOOLEAN DEFAULT FALSE );
But when I check it in phpmyadmin, BOOLEAN
fields are tinyint(1)
and they are 0
by default. I can make 1
to be TRUE
. But when I use ===
in my PHP code, they can't be converted. (I should use ==
in if
, for
, while
and I think it can make some bug in my system.)
So, how should I solve it? How should I get it BOOLEAN by default from mysql?