I am trying to omit a column from updating if the value is empty, but would like it to update if its not empty.
So far I came with the following expression
$foo = NULL;
$query = "UPDATE test SET column1 = IF('{$foo}'='',coloumn1,'' )";
$result = mysqli_query($handle,$query);
if(!$result){
echo mysqli_error($handle);
}
The problem that I am facing is when I set $foo to an actual value coloumn1 is empty again.
I am not sure why. If anyone can help me understand this, I would really appreciate it! Thanks!