In my bind parameters, I am trying to insert answers for each question. I have a simple question which is asking that if a question has no answer, how can I insert the word No Answer in its place in the db? This is because at the moment it will not insert any rows are where the answer is NULL. It only does insert if the question has at minimum one answer
Below is attempt:
$results = $_POST['value'];
foreach($results as $id => $value)
{
$answer = $value;
$quesid = $question_ids[$id];
if($answer = ''){
$answer = 'No Answer';
}
foreach($value as $answer)
{
$insertanswer->bind_param("is", $quesid, $answer);
$insertanswer->execute();
if ($insertanswer->errno) {
// Handle query error here
echo __LINE__.': '.$insertanswer->error;
break 7;
}
}
}
If it is a text input then
if($answer == '' || $answer === null){, if it i from a drop down menu then retrive the value:if($answer == ''){ //'' is whatever the value is for this option