Re: Booleans

From: Keary Suska <hierophant(at)pcisys(dot)net>
To: Postgres-PHP <pgsql-php(at)postgresql(dot)org>
Subject: Re: Booleans
Date: 2002-11-04 17:27:10
Message-ID: B9EBFBFE.14F7B%hierophant@pcisys.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

on 11/4/02 9:26 AM, scott(dot)marlowe(at)ihs(dot)com purportedly said:

> To set your values, I'd suggest using the TRUE and FALSE method, like so:
>
> insert into table (a,b,c) values (TRUE,FALSE,FALSE)
>
> So that you use PHP to set each field to TRUE or FALSE (note there's no '
> marks around the TRUE or FALSE).

This would work only if the fields are boolean. Unfortunately, bit fields
are a poor choice to store boolean values, and you don't get any real
benefit from them.

You will have to force PHP to convert your values into a number, such as
$a = $a|0 or $a = number_format( $a )
or use the workaround mentioned in your original email.

You should also use proper bit string constant syntax, prefacing each value
with "B":
insert into table (a,b,c) values (B'$a',B'$b',B'$c')

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Jascha Schubert 2002-11-04 17:35:24 Re: Booleans
Previous Message scott.marlowe 2002-11-04 16:26:05 Re: Booleans