SELECTING field - is not empty - using mysql

hi, can you do a select based on whether a field is empty or not / true or not

basically, i want to do something like

$sql = SELECT * FROM table WHERE field IS TRUE

or

$sql = SELECT * FROM table WHERE field IS NOT EMPTY

and then in PHP:

i can just do something like

$check = mysql_query(“$sql”);

if(mysql_num_rows($check) > ‘0’)
{
//do something
}

Thanks in advance for your help.

mysql doesn’t support booleans, so you cannot use IS TRUE

the “not empty” concept you are looking for is IS NOT NULL

what kind of field is it? what will it be used for? what datatype are you thinking of using?

Hi, thanks for your help. Basically i’m integrating a payment system (barclycard edpq) into a website. I have to update the db based on the transaction status that they return. Unhelpfully, barclycard return a string rather than an interger to do this. As part of the exception handling in the script, (for instance the buyer may click the back button and the order fulfilment script might try and add the transaction status again) I basically just need to check to see if the transaction status already exists so i can decide whether it needs inserting or not.

oh, i see