pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedbooleans
5+ messages / 3 participants
[nested] [flat]
* booleans
@ 1998-12-29 15:39 Gregory Holston <holston@itd.nrl.navy.mil>
0 siblings, 1 reply; 5+ messages in thread
From: Gregory Holston @ 1998-12-29 15:39 UTC (permalink / raw)
To: pgsql-sql@hub.org
Good day all,
I just wrote an HTML form with a PHP script to enter data into a table
witha boolean field. When I pressed enter it returned the following error
"Warning: PostgresSQL query failed: ERROR: Bad boolean external
representation". The script is as follows:
if( $id ) {
pg_Exec($conn, "INSERT into authors
VALUES ('$pubrelease', '$id', '$first');");
}
I would appreciate any help.
Thanks,
-Greg
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] booleans
@ 1998-12-29 17:28 Jose' Soares <jose@sferacarta.com>
parent: Gregory Holston <holston@itd.nrl.navy.mil>
0 siblings, 1 reply; 5+ messages in thread
From: Jose' Soares @ 1998-12-29 17:28 UTC (permalink / raw)
To: Gregory Holston <holston@itd.nrl.navy.mil>; +Cc: pgsql-sql@hub.org
Gregory Holston wrote:
>
> Good day all,
>
> I just wrote an HTML form with a PHP script to enter data into a table
> witha boolean field. When I pressed enter it returned the following error
> "Warning: PostgresSQL query failed: ERROR: Bad boolean external
> representation". The script is as follows:
>
> if( $id ) {
> pg_Exec($conn, "INSERT into authors
> VALUES ('$pubrelease', '$id', '$first');");
> }
>
> I would appreciate any help.
>
Postgres supports bool as the SQL3 boolean type. bool can have one of
only two states: 'true' or 'false'.
Boolean accepts only one of the following values:
True: 't', TRUE, 't', 'true', 'y', 'yes', '1'
False: 'f', FALSE, 'f', 'false', 'n', 'no', '0'
- Note that you have to enclose data between '' except for words
TRUE/FALSE.
Probably you are trying to insert data in a different way.
-Jose'-
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] booleans
@ 1998-12-29 17:36 Gregory Holston <holston@itd.nrl.navy.mil>
parent: Jose' Soares <jose@sferacarta.com>
0 siblings, 1 reply; 5+ messages in thread
From: Gregory Holston @ 1998-12-29 17:36 UTC (permalink / raw)
To: Jose' Soares <jose@sferacarta.com>; +Cc: pgsql-sql@hub.org
Initially I was inputing 't' and 'f'. Then I tried 1 and 0 and it
worked. PHP3 cannot parse t or f I guess.
Thanks for the info,
-Greg
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] booleans
@ 1998-12-29 22:45 Eric McKeown <ericm@palaver.net>
parent: Gregory Holston <holston@itd.nrl.navy.mil>
0 siblings, 1 reply; 5+ messages in thread
From: Eric McKeown @ 1998-12-29 22:45 UTC (permalink / raw)
To: Gregory Holston <holston@itd.nrl.navy.mil>; +Cc: Jose' Soares <jose@sferacarta.com>; pgsql-sql@hub.org
On Tue, 29 Dec 1998, Gregory Holston wrote:
> Date: Tue, 29 Dec 1998 12:36:32 -0500 (EST)
> From: Gregory Holston <holston@itd.nrl.navy.mil>
> To: Jose' Soares <jose@sferacarta.com>
> Cc: pgsql-sql@hub.org
> Subject: Re: [SQL] booleans
>
>
> Initially I was inputing 't' and 'f'. Then I tried 1 and 0 and it
> worked. PHP3 cannot parse t or f I guess.
Did you echo your query on the page on which you execute it to see exactly
what it looks like when you're trying it with 't' and 'f'?? I'd bet
you're having some problem related to the escaping of quotes. What is
your magic_quotes_gpc setting? PHP shouldn't have any problems delivering
this query to Postgres...
>
> Thanks for the info,
>
> -Greg
>
>
_______________________
Eric McKeown
ericm@palaver.net
http://www.palaver.net
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] booleans
@ 1998-12-30 14:22 Gregory Holston <holston@itd.nrl.navy.mil>
parent: Eric McKeown <ericm@palaver.net>
0 siblings, 0 replies; 5+ messages in thread
From: Gregory Holston @ 1998-12-30 14:22 UTC (permalink / raw)
To: Eric McKeown <ericm@palaver.net>; +Cc: pgsql-sql@hub.org
I wouldn't think it would have any problem handling this code either,
code I used was :
if( $id ) {
pg_Exec($conn, "INSERT into authors
values ('$pubrelease', '$id', '$first');");
}
First was the variable where the boolean, t or f was to be placed in the
HTML form. I did not put quotes insert them with quotes for this is
already done with the PHP. This works for int, text, etc. hich was why I
was surprised by the error message.
-Greg
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~1998-12-30 14:22 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-12-29 15:39 booleans Gregory Holston <holston@itd.nrl.navy.mil>
1998-12-29 17:28 ` Jose' Soares <jose@sferacarta.com>
1998-12-29 17:36 ` Gregory Holston <holston@itd.nrl.navy.mil>
1998-12-29 22:45 ` Eric McKeown <ericm@palaver.net>
1998-12-30 14:22 ` Gregory Holston <holston@itd.nrl.navy.mil>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox