$query = "INSERT INTO Costs (StartDate, EndDate, AdultsMainWeekday, AdultsMainWeekend) VALUES ('$date[0]', '$date[$last]', '$rows[$x][AdultsMainWeekday]', '$rows[$x][AdultsMainWeekend]')";
$result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link));