PHP中的MySQL NULL

Is there a way to put a php string variable 'dynamically' in a mysql statement so that if its value is 'NULL' the quotes are removed within the query statement? Here's the code:

$sql="UPDATE products SET title='$title', supplier='$supplier', availability='$availability', condition='$condition', brand='$brand', power='$power', category='$category', min_qty='$min_qty', cost='$cost' WHERE id='$id'";

All the variables are strings, however I want that if one of these strings is 'NULL', it is effectively treated as mysql NULL (and not as the 'NULL' string). Is there a quick way to do that? Thanks in advance!

You can do it like this:

$sql="UPDATE products SET title='$title', supplier='$supplier', availability='$availability', condition=".($condition != null) ? "(".$condition.")" : "NULL"", brand='$brand', power='$power', category='$category', min_qty='$min_qty', cost='$cost' WHERE id='$id'";

Look at $condition. This is an easy way to act with if-statements in strings.