ERROR WHEN ENCOUNTERING NULL, how to solve

I have a grid that has a total and WHERE clause that involves customer_id = {…}

I get an error (obviously!) when customer_id is NULL.

Where do I trap this error? I tried in onRecord, but does not work, e.g I put, as a test:

IF ({customer_id} = ‘’){
{customer_id} = 1;
}

Does not work. Also tried:

if (isset({customer_id})) {
{customer_id} = {customer_id};
}else
{{customer_id} = 1;}

Does not work.

To test if values are equal in php you need to use == in stead of = so:

if ({customer_id}==’’) etc.

[QUOTE=aducom;21417]To test if values are equal in php you need to use == in stead of = so:

if ({customer_id}==’’) etc.[/QUOTE]

Thanks. But …
if ({customer_id} == ‘’) {
{customer_id} = 1;
}

does not work.

http://www.php.net/manual/en/language.types.null.php

[QUOTE=michael;21437]Thanks. But …
if ({customer_id} == ‘’) {
{customer_id} = 1;
}

does not work.[/QUOTE]

Why can you test/filter out NULLS in the SQL QUERY "WHERE customer_id IS NOT NULL or something similar ??