'!Y!N!'); if (in_array($cat['TYPE'], array('M', 'C'))) { $cat['BASE']='N'; } foreach ($cat as $tag => $tag_val) { if (!empty($tag_val) && array_key_exists($tag, $SelFields) && (strpos($SelFields[$tag], '!'.$tag_val.'!') === FALSE)) { $e_cat[$tag.'_1']=TRUE; } if (in_array($tag, $NotEmpty) && empty($tag_val)) { $e_cat[$tag.'_R']=TRUE; } } $query='select count(*) from style where cat_desc="'.$cat['CAT_DESC'].'" and sg="'.$Comp_SG.'" and type_seq!="'.$TypeSeq.'" and cat!="'.$Cat.'"'; $cnt_res=mysqli_query($db, $query); $cnt_row=mysqli_fetch_row($cnt_res); if ($cnt_row[0] > 0) { $e_cat['CAT_DESC_1']=TRUE; } if (count($e_cat) == 0) { if (!$Edit) { $query='insert into style values(null, "'.$Comp_SG.'", "'.$TypeSeq.'", "'.$Cat.'", "'.$cat['CAT_DESC'].'", "'.$Type.'", '; $query.='"'.$cat['BASE'].'", now())'; if (!mysqli_query($db, $query)) { $e_cat['INSERT']=TRUE; } else { $query='insert into changelog values(null, null, "'.$Key.'", "style", "A", "", "'.$Comp_SG.':'.$TypeSeq.':'.$Cat.'", "", "")'; mysqli_query($db, $query); } if ($CatType == 'B') { $SweetCarb='N", "N'; } else { if ($Comp_SG == '2015') { $SweetCarb=($CatType == 'C' ? 'I", "D' : 'H", "D'); } else { $SweetCarb='8", "7'; } } $query='insert into style_sub values(null, "'.$Comp_SG.'", "'.$TypeSeq.'", "'.$Cat.'", "", "'.$cat['CAT_DESC'].'", "0", "N", "N", '; $query.='"'.($Type == 'M' ? 'Y' : 'N').'", '; $query.='"'.$SweetCarb.'", "N", now())'; if (!mysqli_query($db, $query)) { $e_cat['INSERT']=TRUE; } else { $query='insert into changelog values(null, null, "'.$Key.'", "style_sub", "A", "", "'.$Comp_SG.':'.$TypeSeq.':'.$Cat.':'.'", "", "")'; mysqli_query($db, $query); } } else { $query='select * from style where sg="'.$Comp_SG.'" and type_seq="'.$TypeSeq.'" and cat="'.$Cat.'"'; $cat_res=mysqli_query($db, $query); $cat_row=mysqli_fetch_assoc($cat_res); foreach ($Map as $tag => $row) { if ($cat[$tag] != $o_cat[$tag]) { if ($o_cat[$tag] != $cat_row[$row]) { $e_cat[$tag.'_C']=TRUE; } } } if (count($e_cat) == 0) { foreach ($Map as $tag => $row) { if ($cat[$tag] != $o_cat[$tag]) { $query='update style set '.$row.'="'.$cat[$tag].'" where sg="'.$Comp_SG.'" and type_seq="'.$TypeSeq.'" and cat="'.$Cat.'"'; if (!mysqli_query($db, $query)) { $e_cat['UPDATE']=TRUE; } else { $query='insert into changelog values(null, null, "'.$Key.'", "style", "C", "'.$row.'", "'.$Comp_SG.':'.$TypeSeq.':'.$Cat.'", "'.$o_cat[$tag].'", "'.$cat[$tag].'")'; mysqli_query($db, $query); } } } } } } if (count($e_cat) != 0) { $Page='cat.php?k='.$Key.'&c='.$Cat.'&s=1&a='.$Action; } else { $Page='cat_list.php?k='.$Key.'#'.disp_cat($TypeSeq, $Cat).'"'; } ?>

Validating Category Information

'."\n"; echo 'Category '.disp_cat($TypeSeq, $Cat).' '.($Edit ? 'Updated' : 'Created')."\n"; echo '
'."\n"; echo $CatDesc."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo '
'."\n"; echo ''."\n"; echo '
'."\n"; if (cntSubCat($cat_row['type_seq'], $cat_row['cat']) > 0) { echo '
'."\n"; $query='select * from style_sub where sg="'.$Comp_SG.'" and type_seq="'.$TypeSeq.'" and cat="'.$Cat.'" order by sub_cat'; $subcat_res=mysqli_query($db, $query); echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; while ($subcat_row=mysqli_fetch_assoc($subcat_res)) { echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; } echo '
'."\n"; echo 'Category'."\n"; echo ''."\n"; echo 'Description'."\n"; echo '
'."\n"; echo ''.$subcat_row['sub_cat'].''."\n"; echo ''."\n"; echo $subcat_row['cat_desc']."\n"; echo '
'."\n"; } } ?>
'."\n"; echo '