if문장을 case 문으로 간단히 바꾸고자합니다 정보
if문장을 case 문으로 간단히 바꾸고자합니다본문
그룹별 페이지 레이아웃을 만들고 있습니다.
링크주소의 끝단에 'gid=그룹명'을 붙이는 방법으로 주소안에 맞는 경로가 있는경우
해당 레이아웃관련 변수를 대입하는 형식입니다.
변수처리는 이상이 없습니다만,
동일한 값을 처리하는 문장이 불필요하게 길어져서
이것을 case 문으로 바꿔서 만들고자하는데...........
아래의 if문을 case 문으로 바꾸려면 어떻게 해야할까요?
if(eregi("gid=1", $REQUEST_URI) || !$gid) {
$head_common = '_common_top.php';
$head_group = '_head_common_main.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=tmb", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=tmc", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=tmg", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=busan", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=tmx", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=tmy", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=tmb", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
?>
링크주소의 끝단에 'gid=그룹명'을 붙이는 방법으로 주소안에 맞는 경로가 있는경우
해당 레이아웃관련 변수를 대입하는 형식입니다.
변수처리는 이상이 없습니다만,
동일한 값을 처리하는 문장이 불필요하게 길어져서
이것을 case 문으로 바꿔서 만들고자하는데...........
아래의 if문을 case 문으로 바꾸려면 어떻게 해야할까요?
if(eregi("gid=1", $REQUEST_URI) || !$gid) {
$head_common = '_common_top.php';
$head_group = '_head_common_main.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=tmb", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=tmc", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=tmg", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=busan", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=tmx", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=tmy", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
if(eregi("gid=tmb", $REQUEST_URI)){
$head_common = '_common_top.php';
$head_group = '_head_common_group.php';
$tbl_width = 890;
$tbl_left = 90;
$tbl_main = 520;
$tbl_right = 270;
}
?>
( select a.* , ( select sum(co_count) as co_count from g4_qa_choose where mb_id=a.mb_id and bo_table = 'g4_qa' ) as q_co_count from `g4_write_g4_qa` a where wr_parent = '229630' and wr_8 != '' and wr_is_comment = 1 and CONVERT(wr_7, UNSIGNED) >= 5 group by wr_content having max(wr_7) order by CONVERT(wr_7, UNSIGNED) desc limit 3 )
1055 : Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'sir.a.wr_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
error file : /15sir/bbs/board.php