I'm updating a row in a database, however the fields passed by $_POST are not required fields, so they may not be passed at all, I'm updating my db row here
$wpdb->update(
'learning_evaluation_questions',
array(
'question_content' => $_POST['question'],
'question_placeholder' => $_POST['placeholder']
),
array(
'id'=> $id
)
);
Which works fine, it updates the row - however if I haven't passed one of these values through $_POST it will set this value to null.
i.e.
'question_content' => NULL,
Anyway to conditionally check these to only update if !NULL
?
EDIT: Sorry I should have explained that even if one of these is set I want to update, if they want to update just the question_placeholder - then I want to update that without the question_content value setting to NULL