I do use the "ENUM" technique quite a bit, with good results.

it's even easier if you set the ENUM values to 1 and 0, then when you do a
database query, you don't have to read the string, you can simply check for
it's presence.

Here's a fictitious example:

In user_table, make a field for "is_admin" ENUM('0','1')

then when you do a SQL query:

                username = '$username'

do a query, and mysql_fetch_object (or however you get your DB query

if ($row->is_admin) {
        // This code will only be executed
        // if the is_admin field is set to "1"
        ... code ...

I use phpMyAdmin to adminster the DB.  To setup an ENUM field in phpMyAdmin,
you select ENUM from the dropdown box in the column "TYPE", and place the
possible values in the "Length/Values" - for the above example, you would
simply type '0','1' in the values text box.  (I'm sorry if I'm being
redundant with info you already know, I just remember it being confusing for
me when I set up my first enum field)

I hope this helps,

> in this direction, but .. hey does nobody do this like that??

> > > > > I am searching for the best way to store true or false inside
> > > > > a MySQL DB. With best I mean the most data efficient way and
> > > > > in the same time the best for fast searching later on the
> > > > > table to find all which are false, or true. I think I did read
> > > > > something about a way to do this with ENUM, but cant remember
> > > > > where and how, all tryes did not succeeed so far.
> > > > >
> > > > > Thanx for any help on that.
> > > > >


PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to