분류(카테고리) 질문이요!
본문
분류가 있는 해당 게시판에 들어가면 그 분류 최신글의 상세페이지로 바로 가게끔하고 싶은데 어떻게 해야할까요?
예를 들어서
/gboard/bbs/board.php?bo_table=director 여기 게시판에 들어가면 /gboard/bbs/board.php?bo_table=director&wr_id=1 여기로 바로 가게끔 해놨는데 분류가 있으면 wr_id값이 안 바뀌네요.. ㅜㅜ어떻게 해야 할까요? 소스는
$subsql = " select * from $g5[write_prefix]$bo_table ";
$subrow = sql_fetch($subsql);
$sql = " select wr_id from 분류글테이블 where 분류조건 ";
$sql .=" order by no desc "; //<-- 최신글이라는 가정
$sql .=" limit 1 "; //1개의 데이타
$row = sql_fetch($sql);
$cat_wr_id = $row['wr_id'];
if($bo_table == "petition" && $sca == "모집요강"){
goto_url("./board.php?bo_table=$bo_table&wr_id=$subrow[wr_id]&sca=모집요강");
} else if ($bo_table == "petition" && $sca == "학과소개") {
goto_url("./board.php?bo_table=$bo_table&wr_id=$subrow[wr_id]&sca=학과소개");
}
답변 3
$subsql = " select * from $g5[write_prefix]$bo_table ".$where;
$subsql .= " order by wr_id desc limit 1";
$subrow[wr_id] 이게 값이 없다는것같은데...
$where = '';
if($ca_name) $where = " where ca_name = '{$ca_name}' ";
$subsql = " select * from $g5[write_prefix]$bo_table ".$where;
$subrow = sql_fetch($subsql);
/* 이건 어디서 사용하는지 모르겠네요.
$sql = " select wr_id from 분류글테이블 where 분류조건 ";
$sql .=" order by no desc "; //<-- 최신글이라는 가정
$sql .=" limit 1 "; //1개의 데이타
$row = sql_fetch($sql);
$cat_wr_id = $row['wr_id'];
*/
if($bo_table == "petition" && $sca == "모집요강"){
goto_url("./board.php?bo_table=$bo_table&wr_id=$subrow[wr_id]&sca=모집요강");
} else if ($bo_table == "petition" && $sca == "학과소개") {
goto_url("./board.php?bo_table=$bo_table&wr_id=$subrow[wr_id]&sca=학과소개");
}
답변을 작성하시기 전에 로그인 해주세요.