From 9881ddb968aa74f8746439d401460d6e21e35bce Mon Sep 17 00:00:00 2001 From: james Date: Mon, 16 Jan 2006 18:19:12 +0000 Subject: [PATCH] Only try to insert category preferences if they've submitted category preferences --- register_judges_personal.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/register_judges_personal.php b/register_judges_personal.php index adc4249..7ecef49 100644 --- a/register_judges_personal.php +++ b/register_judges_personal.php @@ -76,9 +76,12 @@ } mysql_query("DELETE FROM judges_catpref WHERE judges_id='".$_SESSION['judges_id']."'"); - foreach($_POST['catpref'] AS $k=>$v) + if(is_array($_POST['catpref'])) { - mysql_query("INSERT INTO judges_catpref (judges_id,projectcategories_id,rank,year) values ('".$_SESSION['judges_id']."','$k','$v','".$config['FAIRYEAR']."')"); + foreach($_POST['catpref'] AS $k=>$v) + { + mysql_query("INSERT INTO judges_catpref (judges_id,projectcategories_id,rank,year) values ('".$_SESSION['judges_id']."','$k','$v','".$config['FAIRYEAR']."')"); + } } echo notice(i18n("%1 %2 successfully updated",array($_POST['firstname'],$_POST['lastname'])));