Re: boolean error

From: Chris <csmith(at)squiz(dot)net>
To: "P(dot) Jourdan" <pippo(at)videotron(dot)ca>, pgsql-php(at)postgresql(dot)org
Subject: Re: boolean error
Date: 2002-05-02 23:16:25
Message-ID: 5.1.0.14.0.20020503090845.00ac30b0@cooee.cybersydney.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Hi Philip,

>I am getting this in the error log file:
>ERROR: Bad boolean external representation
>'<font >color=red><b>YES></b></font>'

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="<font color=red><b>YES</b></font>";
> }

There are a couple of ways to fix this.

Use a different variable name for displaying the "<font color=red>" - 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 "<font color=red>YES</font>";
} else {
echo "ARCHIVED IS NO";
}

Hope that helps a bit.

-----------------
Chris Smith
http://www.squiz.net/

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Duncan Adams (DNS) 2002-05-03 07:46:20 Re: type of a field
Previous Message Rod Taylor 2002-05-02 23:11:33 Re: [PHP] sql commands