I have an if statement. If a condition is true the query is an INSERT query, else it is an UPDATE query. If i am updating the row, it works fine. But the insert part doesn't. And it is being submitted and not returning errors so I have no clue what the error is. I have looked over it a thousand times.
The insert query
$query = "INSERT INTO exhibitions (code, name, description,
notes, status, image, slug, start_date, end_date)
VALUES (?,?,?,?,?,?,?,?,?)";
$stmt = $connection->prepare($query);
$stmt->bind_param('sssssssss', $code, $new_name, $new_description, $new_notes, $new_status,
$new_image, $new_slug, $new_startDate, $new_endDate);
Where the statement is executed
if($stmt->execute()) {
$stmt->close();
updateActivityWithDetails($_SESSION['userCode'], $activityId, $code, $name, $connection);
//header("Location:/view-exhibitions/");
$_SESSION['form-alert'] = '
<div class="alert alert-success">
<i class="fa fa-check-circle"></i> '.$activityDesc.'
</div>';
if($_POST['action'] == 'edit' || $_POST['action'] == 'save'){
//header('Location: /'.$productfolder.'/view-exhibitions/'.$code);
}else{
}
}
else {
$_SESSION['form-alert'] = '
<div class="alert alert-danger">
<i class="fa fa-check-circle"></i><strong> System Warning </strong>
There was a serious error with the system. You request could not be processed. If the problem persists, please contact the '.$systemName.' Support Team
</div>
';
}