카테고리 검색 질문좀 드리겠습니다 ㅠ 정보
카테고리 검색 질문좀 드리겠습니다 ㅠ본문
오류가 나는곳의 주소를 알려주시면 더 빠르고 정확하게 답변 받을 수 있습니다.
안녕하세요 , 이제 막 공부 시작한 초보입니다 ㅠ
몇일 동안 검색과 생각을 해봐도 답이 잘 나오지 않아 질문좀 드리겠습니다 ..
현재 다중 카테고리를 사용해서 글을 작성할 때 여려개의 카테고리를 넣을수 있도록 설정해 놓았고,
ca_name에 A,B B,C A,C 형식으로 콤마를 포함해서 입력되고 있습니다.
여기서 A란 카테고리가 들어간 리스트만 뽑으려고 하는데요..
ca_name에 A,C 가됐던 A,B가 됐건 무조건 A만 들어가면 출력되게끔 하고 싶습니다..
정규문을 쓰고 별짓을 해봐도 잘 안풀리네요..
아래 sql문 중 ca_name = $ca_name 부분에서 같을때가 아니라 포함되어 있을때로 바꾸기만 해주면 될것 같은데.. 무지해서 잘 모르겠네요..
힌트좀 주시면 감사하겠습니다 !
오류 주소 :
function latest_caname($skin_dir="", $bo_table, $rows=10, $ca_name, $brch="", $skin_folder="skin", $subject_len="255", $options="")
{
global $g4, $g4_board;
$latest_skin_path = "{$g4['path']}/{$skin_folder}/latest/{$skin_dir}";
$list = array();
if(!$g4_board or !$g4_board["$bo_table"]){
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$g4_board["$bo_table"] = sql_fetch($sql);
}
$board = $g4_board["$bo_table"];
$tmp_write_table = $g4['write_prefix'] . $bo_table;
if (!$brch)
$brch = "wr_num asc";
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and ca_name = '$ca_name' order by $brch, wr_reply limit 0, $rows ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
}
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
안녕하세요 , 이제 막 공부 시작한 초보입니다 ㅠ
몇일 동안 검색과 생각을 해봐도 답이 잘 나오지 않아 질문좀 드리겠습니다 ..
현재 다중 카테고리를 사용해서 글을 작성할 때 여려개의 카테고리를 넣을수 있도록 설정해 놓았고,
ca_name에 A,B B,C A,C 형식으로 콤마를 포함해서 입력되고 있습니다.
여기서 A란 카테고리가 들어간 리스트만 뽑으려고 하는데요..
ca_name에 A,C 가됐던 A,B가 됐건 무조건 A만 들어가면 출력되게끔 하고 싶습니다..
정규문을 쓰고 별짓을 해봐도 잘 안풀리네요..
아래 sql문 중 ca_name = $ca_name 부분에서 같을때가 아니라 포함되어 있을때로 바꾸기만 해주면 될것 같은데.. 무지해서 잘 모르겠네요..
힌트좀 주시면 감사하겠습니다 !
오류 주소 :
function latest_caname($skin_dir="", $bo_table, $rows=10, $ca_name, $brch="", $skin_folder="skin", $subject_len="255", $options="")
{
global $g4, $g4_board;
$latest_skin_path = "{$g4['path']}/{$skin_folder}/latest/{$skin_dir}";
$list = array();
if(!$g4_board or !$g4_board["$bo_table"]){
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$g4_board["$bo_table"] = sql_fetch($sql);
}
$board = $g4_board["$bo_table"];
$tmp_write_table = $g4['write_prefix'] . $bo_table;
if (!$brch)
$brch = "wr_num asc";
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and ca_name = '$ca_name' order by $brch, wr_reply limit 0, $rows ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
}
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
댓글 전체
제일 간단한 방법
이부분을
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and ca_name = '$ca_name' order by $brch, wr_reply limit 0, $rows ";
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and ca_name like '%$ca_name%' order by $brch, wr_reply limit 0, $rows ";
요걸로 대체해주세요 대신 느려질 수도 있음
이부분을
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and ca_name = '$ca_name' order by $brch, wr_reply limit 0, $rows ";
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and ca_name like '%$ca_name%' order by $brch, wr_reply limit 0, $rows ";
요걸로 대체해주세요 대신 느려질 수도 있음
많은 도움 되었습니다
정말 감사드립니다 ㅠ!!
정말 감사드립니다 ㅠ!!