Checking for bollean value...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rlogin
Forum Newbie
Posts: 19
Joined: Fri Oct 18, 2002 2:39 am

Checking for bollean value...

Post 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
smesquita
Forum Newbie
Posts: 7
Joined: Wed Oct 23, 2002 5:53 am

Post 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'
Post Reply