이 소스 해석 좀 해주실분ㅠㅠㅠ
본문
// 글이 있다면 뷰페이지로 없다면 쓰기버튼 출력
$subsql = "
select MAX(A.wr_id) as m_wr_id, A.ca_name as m_ca_name from
(
SELECT wr_id, ca_name FROM $g5[write_prefix]$bo_table $where $andless
UNION ALL
SELECT 0 as wr_id, 'Book' as ca_name
UNION ALL
SELECT 0 as wr_id, 'Magazine' as ca_name
UNION ALL
SELECT 0 as wr_id, 'Brochure' as ca_name
UNION ALL
SELECT 0 as wr_id, 'Catalogue' as ca_name
UNION ALL
SELECT 0 as wr_id, 'Annual+Report' as ca_name
UNION ALL
SELECT 0 as wr_id, 'Poster' as ca_name
UNION ALL
SELECT 0 as wr_id, 'C.I' as ca_name
UNION ALL
SELECT 0 as wr_id, 'Customizing' as ca_name
) A
GROUP BY A.ca_name
ORDER BY A.wr_id DESC
";
$subrow = sql_fetch($subsql);
if(!$wr_id) {
if ($_GET[sca] == "")
{
goto_url("./board.php?bo_table=$bo_table&sca=$sca&wr_id=$subrow[m_wr_id]");
} else {
$subresult = sql_query($subsql);
while($subrow = sql_fetch_array($subresult))
{
if ($_GET[sca] == $subrow[m_ca_name])
{
if ($subrow[m_wr_id]!=0) goto_url("./board.php?bo_table=$bo_table&sca=$sca&wr_id=$subrow[m_wr_id]");
}
}
}
} else if ($write_href) {
답변 1
저두잘몰라서 대충 아는부분만...
$subsql = "
select MAX(A.wr_id) as m_wr_id, A.ca_name as m_ca_name from
(
SELECT wr_id, ca_name FROM $g5[write_prefix]$bo_table $where $andless
UNION ALL
SELECT 0 as wr_id, 'Book' as ca_name
UNION ALL
SELECT 0 as wr_id, 'Magazine' as ca_name
UNION ALL
SELECT 0 as wr_id, 'Brochure' as ca_name
UNION ALL
SELECT 0 as wr_id, 'Catalogue' as ca_name
UNION ALL
SELECT 0 as wr_id, 'Annual+Report' as ca_name
UNION ALL
SELECT 0 as wr_id, 'Poster' as ca_name
UNION ALL
SELECT 0 as wr_id, 'C.I' as ca_name
UNION ALL
SELECT 0 as wr_id, 'Customizing' as ca_name
) A
GROUP BY A.ca_name
ORDER BY A.wr_id DESC
";
$subrow = sql_fetch($subsql); //쿼리문의 셀렉트 값을 $subrow 에 저장
if(!$wr_id) { //만약에 $wr_id 가 없으면
if ($_GET[sca] == "") //만약에 $_GET[sca] 값이 ""(공백)일때
{
goto_url("./board.php?bo_table=$bo_table&sca=$sca&wr_id=$subrow[m_wr_id]"); //페이지이동
} else { //아니면
$subresult = sql_query($subsql); //쿼리문의 셀렉트 값을 $subrow 에 저장
while($subrow = sql_fetch_array($subresult)) //쿼리문의 인덱스 값까지 반복문
{
if ($_GET[sca] == $subrow[m_ca_name]) // 만약 ($_GET[sca] 값이 $subrow[m_ca_name] 같다면
{
if ($subrow[m_wr_id]!=0) goto_url("./board.php?bo_table=$bo_table&sca=$sca&wr_id=$subrow[m_wr_id]");// 만약에 $subrow[m_wr_id]값이 0이면 ./board.php?bo_table=$bo_table&sca=$sca&wr_id=$subrow[m_wr_id] 여기로 페이지 이동
}
}
}
} else if ($write_href) { // 분명 밑에 더있을텐데요