Re: boolean error

Поиск
Список
Период
Сортировка
От Chris
Тема Re: boolean error
Дата
Msg-id 5.1.0.14.0.20020503090845.00ac30b0@cooee.cybersydney.com.au
обсуждение исходный текст
Ответ на boolean error  ("P. Jourdan" <pippo@videotron.ca>)
Список 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/


В списке pgsql-php по дате отправления:

Предыдущее
От: Chris
Дата:
Сообщение: Re: sql command
Следующее
От: "Duncan Adams (DNS)"
Дата:
Сообщение: Re: type of a field