검색인데 제목만 검색이되네요 정보
검색인데 제목만 검색이되네요본문
오류가 나는곳의 주소를 알려주시면 더 빠르고 정확하게 답변 받을 수 있습니다.
오류 주소 : http://economyview.cafe24.com/index.php
$g4['title'] = '';
include_once('../global_head.php');
$sql_common = " reg_yn ='Y' ";
if ($nstx) {
$sql_search .= "and (title like '%$nstx%') and w " ;
$qstr .="&nstx=$nstx";
}
$sql = " select count(*) as cnt from $g4[news_table] where $sql_common $sql_search ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
$page_cnt = $g4[page_cnt];
$total_page = ceil($total_count / $page_cnt);
if (!$page) $page = "1";
$from_record = ($page - 1) * $page_cnt;
$sql = " select * from $g4[news_table] where $sql_common $sql_search order by news_num desc limit $from_record, $page_cnt ";
$result = sql_query($sql);
//explain($sql);
$list = array();
$k = "0";
for ($idx=0; $row=sql_fetch_array($result); $idx++) {
$list[$idx] = $row;
$list[$idx][href] = "./view.php";
$list[$idx][num] = $total_count - ($page - 1) * $page_cnt - $k;
$k++;
}
if ($total_count > 1) $news_paging = get_news_paging($g4[paging_cnt], $page, $total_page, $_SERVER[PHP_SELF]."?page=", $qstr);
$news_skin_path = "$g4[path]/skin/news/page/basic";
include_once($news_skin_path."/search.skin.php");
지금 검색하니까 제목만 검색이 되네요 ㅜ.ㅜ
전체 검색 되게 할려며은 어떻게 해야하나요
고수님들 도와주세요 ㅠ.ㅠ
오류 주소 : http://economyview.cafe24.com/index.php
$g4['title'] = '';
include_once('../global_head.php');
$sql_common = " reg_yn ='Y' ";
if ($nstx) {
$sql_search .= "and (title like '%$nstx%') and w " ;
$qstr .="&nstx=$nstx";
}
$sql = " select count(*) as cnt from $g4[news_table] where $sql_common $sql_search ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
$page_cnt = $g4[page_cnt];
$total_page = ceil($total_count / $page_cnt);
if (!$page) $page = "1";
$from_record = ($page - 1) * $page_cnt;
$sql = " select * from $g4[news_table] where $sql_common $sql_search order by news_num desc limit $from_record, $page_cnt ";
$result = sql_query($sql);
//explain($sql);
$list = array();
$k = "0";
for ($idx=0; $row=sql_fetch_array($result); $idx++) {
$list[$idx] = $row;
$list[$idx][href] = "./view.php";
$list[$idx][num] = $total_count - ($page - 1) * $page_cnt - $k;
$k++;
}
if ($total_count > 1) $news_paging = get_news_paging($g4[paging_cnt], $page, $total_page, $_SERVER[PHP_SELF]."?page=", $qstr);
$news_skin_path = "$g4[path]/skin/news/page/basic";
include_once($news_skin_path."/search.skin.php");
지금 검색하니까 제목만 검색이 되네요 ㅜ.ㅜ
전체 검색 되게 할려며은 어떻게 해야하나요
고수님들 도와주세요 ㅠ.ㅠ
댓글 전체
7라인에 $sql_search .= "and (title like '%$nstx%') and w " ;
이렇게 된 부분에... title밖에 없어서 그래요...
만약 이름도 같이 검색하고싶으시다 치면...
$sql_search .= "and (title like '%$nstx%') and (name like '%$nstx%') and w " ;
저런식으로.. 구문을 추가해주시면 되요...
단.. 앞에있는 순서대로 먼저 검색이 되고.. 뒤에는 앞에꺼 검색 후에 적용된답니다~
이렇게 된 부분에... title밖에 없어서 그래요...
만약 이름도 같이 검색하고싶으시다 치면...
$sql_search .= "and (title like '%$nstx%') and (name like '%$nstx%') and w " ;
저런식으로.. 구문을 추가해주시면 되요...
단.. 앞에있는 순서대로 먼저 검색이 되고.. 뒤에는 앞에꺼 검색 후에 적용된답니다~
고수님
select count(*) as cnt from g4_news where reg_yn ='Y' and (title like '%유력한%') and (content like '%유력한%') and w
1054 : Unknown column 'w' in 'where clause'
error file : /article/search.php
이렇게 오류가 뜨네요 ㅠ.ㅠ
어찌해야 할까요
select count(*) as cnt from g4_news where reg_yn ='Y' and (title like '%유력한%') and (content like '%유력한%') and w
1054 : Unknown column 'w' in 'where clause'
error file : /article/search.php
이렇게 오류가 뜨네요 ㅠ.ㅠ
어찌해야 할까요
아니면 $sql_search .= "and ( 셀렉트 박스 like '%$nstx%') and w " ;
감사합니다 고수님들^^ 적용해보겠습니다
$sql_search .= "and (title like '%$nstx%') and w " ; -->
$sql_search .= "and ( INSTR(title,'$nstx') or INSTR(content,'$nstx') ) ";
그누보드에 없던 테이블 인가보죠?
and 로 연결하면 안되고 or ...
w는 무슨 필드인지 모르지만 and w 이런 문법 자체가 틀렸습니다
$sql_search .= "and ( INSTR(title,'$nstx') or INSTR(content,'$nstx') ) ";
그누보드에 없던 테이블 인가보죠?
and 로 연결하면 안되고 or ...
w는 무슨 필드인지 모르지만 and w 이런 문법 자체가 틀렸습니다
감사합니다^^