Error checking on judges_teams_timeslots when no teams/timeslots are selected to assign

This commit is contained in:
james 2007-12-11 19:38:25 +00:00
parent fb10ed7447
commit 8a1a67f1be

View File

@ -93,15 +93,20 @@ function checkinvert(what)
{
//the db handles the uniqueness (to ensure the same timeslot isnt assigned to the same team more than once)
//so all we'll do here is just mass insert without regards for whats already there.
foreach($_POST['teams'] AS $tm)
if(count($_POST['teams']) && count($_POST['timeslots'])
{
foreach($_POST['timeslots'] AS $ts)
foreach($_POST['teams'] AS $tm)
{
mysql_query("INSERT INTO judges_teams_timeslots_link (judges_teams_id,judges_timeslots_id,year) VALUES ('$tm','$ts','".$config['FAIRYEAR']."')");
foreach($_POST['timeslots'] AS $ts)
{
mysql_query("INSERT INTO judges_teams_timeslots_link (judges_teams_id,judges_timeslots_id,year) VALUES ('$tm','$ts','".$config['FAIRYEAR']."')");
}
}
echo happy(i18n("%1 Timeslots assigned to %2 teams",array(count($_POST['timeslots']),count($_POST['teams']))));
}
echo happy(i18n("%1 Timeslots assigned to %2 teams",array(count($_POST['timeslots']),count($_POST['teams']))));
else
echo error(i18n("You must select both team(s) and timeslot(s) to assign"));
}
echo "<form name=\"teamstimeslots\" method=\"post\" action=\"judges_teams_timeslots.php\">";