Page 1 of 1

Checking for bollean value...

Posted: Mon Nov 18, 2002 12:00 am
by rlogin
Hi all,
I have a small problem and i want to check it out with you guys and gals...
So here goes:

I have a table in the database with a boolean field and a varchar field.
When i check for a record i this table, first i will check if the boolean field is true or not, and then if the boolean value is true i display the varchar. If the boolean is false, i do not display the varchar field which will in this case contain NULL.

In my code iam not able to check for boolean value at all...
Iam not able to figure out why...

Code: Select all

if($tabledetail->fieldsї0]){
print '$tabledetail->fieldsї1]';
}
else{
print 'Access denied';
}
I have also tried the following code:

Code: Select all

if($tabledetail->fieldsї0]=='t'){
print '$tabledetail->fieldsї1]';
}
else{
print 'Access denied';
}
In the above code i have used '1', ' TRUE' also instead of 't'.
Nothing works.
Can some body tell me how to check for the true value of boolean stored in the database?
Iam using ADODB database abstraction layer with PHP and Postgres.
Rgds

Posted: Mon Nov 18, 2002 9:39 am
by smesquita
Have you tried this:

echo $tabledetail->fields[0];

See what value it returns.

You can also restrict you select query:

SELECT Field1, Field2 FROM Table WHERE Field1='true'