Notice: Undefined offset: 1 in D:\Web\www\football\admin\players.php on line 460
$query = mysqli_query($db_connect, "SELECT
team_season_names.SeasonName AS season_name,
team_seasons.SeasonID AS season_id
FROM team_season_names,team_seasons
WHERE team_seasons.SeasonID = team_season_names.SeasonID
AND team_seasons.SeasonPlayerID = '$player_id'
ORDER BY season_name
") or die(mysqli_error());
$all_seasons = mysqli_query($db_connect, "SELECT SeasonID FROM team_season_names") or die(mysqli_error());
$check_player = mysqli_num_rows($all_seasons);
mysqli_free_result($all_seasons);
$check_players = mysqli_num_rows($query);
$check_seasons = "";
while($data = mysqli_fetch_array($query)) {
echo "".$data['season_name']."<br>\n";
$check_season[] = $data['season_id'];
$check_seasons .= "<option value='".$data['season_id']."'>".$data['season_name']."</option>\n";
}
if ($check_player != $check_players) {
$i = 0;
echo "<br>Copy this Player to Season: <select name='copy_season'>";
$get_seasons = mysqli_query($db_connect, "SELECT * FROM team_season_names ORDER BY SeasonName") or die(mysqli_error());
while($data = mysqli_fetch_array($get_seasons)) {
if ($data['SeasonID'] != $check_season[$i]) { // Line 460
echo "<option value='".$data['SeasonID']."'>".$data['SeasonName']."</option>\n";
} else {
$i++;
}
}
mysqli_free_result($get_seasons);
echo "</select>\n";
echo "<input type='submit' name='copy_season_submit' value='Copy'><br><br>\n";
echo "You may Remove Player from Season: <select name='remove_season'>".$check_seasons."</select>\n";
echo "<input type='submit' name='remove_season_submit' value='Remove'>\n";
echo "<input type='hidden' name='player_id' value='".$player_id."'>\n";
echo "</form>\n";
} else if ($check_player == $check_players) {
echo "You may Remove Player from Season: <select name='remove_season'>".$check_seasons."</select>\n";
echo "<input type='submit' name='remove_season_submit' value='Remove'>\n";
echo "<input type='hidden' name='player_id' value='".$player_id."'>\n";
echo "</form>\n";
}
mysqli_free_result($query);
I all ready use isset() and empty() and they got the error off but then it shows me all seasons for the player and I only want to get the seasons that the player it's not all ready in and another thing it only shows me this error when I only have one season select for the player and it's the first season example 2015/16