if(!in_array(null, $array) or !in_array('', $array)){
$stmt->execute();
}
$array = array('column1' => 2, 'column2' => null);
$setCondition = array();
foreach ($array as $column => $value) {
if (!empty($value)) {
$setCondition[] = "'" . $column . "'= ? ";
$bindValues[] = $value;
}
}
$sql = "UPDATE `table` SET " . implode(' and ', $setCondition) . " WHERE `column` != null and `column` != ''";
if ($setCondition != array()) {
$stmt = $dbh->prepare($sql);
foreach ($bindValues as $key => $value) {
$stmt->bindParam($key, $value);
}
$stmt->execute();
}