$data['referee_acknowledged_on'] = $_POST['requested_on']; $query = "SELECT referrer_read_resume_on FROM referral_requests WHERE id = " . $_POST['request_id'] . " LIMIT 1"; $result = $mysqli->query($query); $data['member_read_resume_on'] = $result[0]['referrer_read_resume_on']; $referral_id = Referral::create($data); if ($referral_id === false || $referral_id <= 0) { echo 'ko'; exit; } if (!Referral::close_similar_referrals_with_id($referral_id)) { echo 'ko'; exit; } } elseif (isset($_POST['referral_id'])) { if (Referral::update($data) !== false) { if (!Referral::close_similar_referrals_with_id($referral_id)) { echo 'ko'; exit; } } else { echo 'ko'; exit; } } else { if (!Referral::create_multiple($data)) { echo 'ko'; exit; } } $positions = ''; $i = 0;