Only foreach if something exists

This commit is contained in:
james 2009-11-02 18:45:22 +00:00
parent eb7b4e1754
commit 6e04220d36

View File

@ -315,14 +315,17 @@ function db_update_116_post()
} }
/* Now write back the judge ids */ /* Now write back the judge ids */
if(count($jtl)) {
foreach($jtl as $id=>$new_id) foreach($jtl as $id=>$new_id)
$q = mysql_query("UPDATE judges_teams_link SET judges_id='$new_id' WHERE id='$id' "); $q = mysql_query("UPDATE judges_teams_link SET judges_id='$new_id' WHERE id='$id' ");
}
if(count($jsal)) {
foreach($jsal as $id=>$new_id) foreach($jsal as $id=>$new_id)
$q = mysql_query("UPDATE judges_specialaward_sel SET judges_id='$new_id' WHERE id='$id' "); $q = mysql_query("UPDATE judges_specialaward_sel SET judges_id='$new_id' WHERE id='$id' ");
}
if(count($qa)) {
foreach($qa as $id=>$new_id) foreach($qa as $id=>$new_id)
$q = mysql_query("UPDATE question_answers SET registrations_id='$new_id' WHERE id='$id' "); $q = mysql_query("UPDATE question_answers SET registrations_id='$new_id' WHERE id='$id' ");
}
} }
?> ?>