forked from science-ation/science-ation
Avoid a 'foreach' on an empty array and ensure subcategories only show for the appropriate years.
This commit is contained in:
parent
d5fd002820
commit
e486d621c8
@ -48,11 +48,15 @@
|
|||||||
if($config['filterdivisionbycategory']=="yes"){
|
if($config['filterdivisionbycategory']=="yes"){
|
||||||
mysql_query("DELETE FROM projectcategoriesdivisions_link WHERE projectdivisions_id='".$_POST['saveid']."' AND year='".$config['FAIRYEAR']."'");
|
mysql_query("DELETE FROM projectcategoriesdivisions_link WHERE projectdivisions_id='".$_POST['saveid']."' AND year='".$config['FAIRYEAR']."'");
|
||||||
|
|
||||||
foreach($_POST['divcat'] as $tempcat){
|
if(is_array($_POST['divcat']))
|
||||||
mysql_query("INSERT INTO projectcategoriesdivisions_link (projectdivisions_id,projectcategories_id,year) VALUES ( ".
|
{
|
||||||
|
foreach($_POST['divcat'] as $tempcat)
|
||||||
|
{
|
||||||
|
mysql_query("INSERT INTO projectcategoriesdivisions_link (projectdivisions_id,projectcategories_id,year) VALUES ( ".
|
||||||
"'".$_POST['id']."', ".
|
"'".$_POST['id']."', ".
|
||||||
"'".$tempcat."', ".
|
"'".$tempcat."', ".
|
||||||
"'".$config['FAIRYEAR']."') ");
|
"'".$config['FAIRYEAR']."') ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//###########
|
//###########
|
||||||
|
@ -149,6 +149,7 @@
|
|||||||
projectdivisions
|
projectdivisions
|
||||||
WHERE
|
WHERE
|
||||||
projectsubdivisions.year='".$config['FAIRYEAR']."'
|
projectsubdivisions.year='".$config['FAIRYEAR']."'
|
||||||
|
AND projectdivisions.year='".$config['FAIRYEAR']."'
|
||||||
AND projectsubdivisions.projectdivisions_id=projectdivisions.id
|
AND projectsubdivisions.projectdivisions_id=projectdivisions.id
|
||||||
ORDER BY
|
ORDER BY
|
||||||
division,subdivision");
|
division,subdivision");
|
||||||
|
Loading…
Reference in New Issue
Block a user