boolean error
am 02.05.2002 18:31:07 von pippo
I am getting this in the error log file:
ERROR: Bad boolean external representation
'color=red>YES>'
The code that is generating the message is all within the php delimiters
(entire file) and appears several times as follows:
if($r1==0 || $r2==0) {
if($archived=='Y') {
$archived="YES";
}
;;;
select wares.ware_id,wares.name,category.name,unit_size,
qty_per_shipping_unit,supplier.name,sku,
case when wares.archived='t' then 'YES'
else wares.archived end as archived,
trademark.name
from wares,category,wares_category,supplier_wares,supplier,tradem ark
where wares.ware_id=wares_category.ware_id and
category.category_id=wares_category.category_id and
wares.ware_id=supplier_wares.ware_id and
supplier_wares.supplier_id=supplier.supplier_id and
wares.trademark_id=trademark.trademark_id";
I do not understand what is wrong? (This apparently worked fine in the
original online web site.)
Does anyone understand this?
Philip Jourdan
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
Re: boolean error
am 02.05.2002 23:20:42 von Surojit Niyogi
It can't understand
color=red>YES>
as a true or false representation for a boolean value. You need to use
either (true or false), (yes or no), or (1 or 0)
Roj Niyogi
Founder
pgHoster - PostgreSQL web hosting
http://www.pghoster.com
P. Jourdan wrote:
> I am getting this in the error log file:
> ERROR: Bad boolean external representation '
> >color=red>YES>'
>
> The code that is generating the message is all within the php
> delimiters (entire file) and appears several times as follows:
>
> if($r1==0 || $r2==0) {
> if($archived=='Y') {
> $archived="YES";
> }
> ;;;
>
> select wares.ware_id,wares.name,category.name,unit_size,
> qty_per_shipping_unit,supplier.name,sku,
> case when wares.archived='t' then '
> color=red>YES' else wares.archived end as archived,
> trademark.name
> from wares,category,wares_category,supplier_wares,supplier,tradem ark
> where wares.ware_id=wares_category.ware_id and
> category.category_id=wares_category.category_id and
> wares.ware_id=supplier_wares.ware_id and
> supplier_wares.supplier_id=supplier.supplier_id and
> wares.trademark_id=trademark.trademark_id";
> I do not understand what is wrong? (This apparently worked fine in the
> original online web site.)
> Does anyone understand this?
> Philip Jourdan
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
>
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
Re: boolean error
am 02.05.2002 23:33:41 von Keary Suska
on 5/2/02 10:31 AM, pippo@videotron.ca purportedly said:
> I am getting this in the error log file:
> ERROR: Bad boolean external representation
> 'color=red>YES>'
>
> The code that is generating the message is all within the php delimiters
> (entire file) and appears several times as follows:
>
> if($r1==0 || $r2==0) {
> if($archived=='Y') {
> $archived="YES";
> }
> ;;;
>
> select wares.ware_id,wares.name,category.name,unit_size,
> qty_per_shipping_unit,supplier.name,sku,
> case when wares.archived='t' then 'YES'
> else wares.archived end as archived,
All return results of a case statement must be coercible to the same type.
Postgres can't coerce 'YES' into a boolean
value (i.e. wares.archived), hence the error. Since booleans can't be cast
to another type, simply return the expected value:
CASE wares.archived
WHEN 't' THEN 'YES'
WHEN 'f' THEN 'f'
ELSE
NULL
END AS archived
Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
Re: boolean error
am 03.05.2002 01:16:25 von Chris
Hi Philip,
>I am getting this in the error log file:
>ERROR: Bad boolean external representation
>'color=red>YES>'
As someone else pointed out, in boolean, you can have Y/1 (true) or N/0
(false); only these values. So when you try to do a boolean check with
this, it doesn't work because this can't be expressed as 0/1 or Y/N, it's a
text string.
>The code that is generating the message is all within the php delimiters
>(entire file) and appears several times as follows:
>
>if($r1==0 || $r2==0) {
> if($archived=='Y') {
> $archived="YES";
> }
There are a couple of ways to fix this.
Use a different variable name for displaying the "" - wild
suggestion - $display_archived - so then the variable $archived isn't
overwritten when it comes time for it to do your SQL query.
Or, just when you display the output of archived, have a little if statement:
if ($archived == 'y') {
echo "YES";
} else {
echo "ARCHIVED IS NO";
}
Hope that helps a bit.
-----------------
Chris Smith
http://www.squiz.net/
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
Re: boolean error
am 03.05.2002 14:51:18 von pippo
At 04:20 PM 5/2/2002 -0500, Roj Niyogi wrote:
>It can't understand
>
>color=red>YES>
>
>as a true or false representation for a boolean value. You need to use
>either (true or false), (yes or no), or (1 or 0)
Right. Someone else had done the code and I am still trying to figure out
just what purpose the formatting served as it does not show up on any page.
I removed the formatting and left the "YES" and now it all works fine.
"Who knows what lies in the hearts of men?... The Shadow does!" :))
Philip Jourdan
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
Re: boolean error
am 03.05.2002 15:02:58 von duncan.adams
I think the formatting should be
YES
not
color=red>YES>
^ ^
ta
duncan
-----Original Message-----
From: P. Jourdan [mailto:pippo@videotron.ca]
Sent: Friday, May 03, 2002 2:51 PM
To: Surojit Niyogi
Cc: pgsql-php@postgresql.org
Subject: Re: [PHP] boolean error
At 04:20 PM 5/2/2002 -0500, Roj Niyogi wrote:
>It can't understand
>
>color=red>YES>
>
>as a true or false representation for a boolean value. You need to use
>either (true or false), (yes or no), or (1 or 0)
Right. Someone else had done the code and I am still trying to figure out
just what purpose the formatting served as it does not show up on any page.
I removed the formatting and left the "YES" and now it all works fine.
"Who knows what lies in the hearts of men?... The Shadow does!" :))
Philip Jourdan
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster