list.php에서 sql 수정

list.php에서 sql 수정

QA

list.php에서 sql 수정

답변 3

본문

shop/list.php 에서 

SQL 문을 수정할려고 그러는데 아무리 수정해도 원하는 효과가 나오질 않네요 ...

/shop/list.php 에서 

80번째 줄 정도에

if($ca_id){

$query = "select *, IF(FIND_IN_SET(1,it_icon)>0,1,'') AS real_icon, IF(FIND_IN_SET(2,it_icon)>0,1,'') AS country_icon from g5_shop_item where (ca_id='$ca_id' or ca_id2='$ca_id' or ca_id3='$ca_id') and it_best in('1','2','3','4','5') order by it_best";

$result=sql_query($query);

if(sql_num_rows($result)>0){

$item_data=null;

for($i=1;$row=sql_fetch_array($result);$i++){

$item_data[$i]=$row;

}

이런 부분이 있는데

$query = "select *, IF(FIND_IN_SET(1,it_icon)>0,1,'') AS real_icon, IF(FIND_IN_SET(2,it_icon)>0,1,'') AS country_icon from g5_shop_item where (ca_id='$ca_id' or ca_id2='$ca_id' or ca_id3='$ca_id') and it_best in('1','2','3','4','5') order by it_best"; 

여기서 조건을 더 추가하고 싶어요 데이터베이스에도 이미 컬럼을 추가해 놓은 상태 입니다.

$query = "select *, IF(FIND_IN_SET(1,it_icon)>0,1,'') AS real_icon, IF(FIND_IN_SET(2,it_icon)>0,1,'') AS country_icon from g5_shop_item where (ca_id='$ca_id' or ca_id2='$ca_id' or ca_id3='$ca_id') and it_best in('1','2','3','4','5') and test = 'y' order by it_best"; 

and test = 'y' 를 추가 하였는데도 원하는 효과가 않나오네요. 

상품출력 쿼리가 이부 분이 아닌것 같은데 어느쪽을 수정하면되죠?

127.0.0.1/shop/list.php?ca_id=w010  

방문 주소는 이주소 입니다(로컬에서 테스트 중).

이 질문에 댓글 쓰기 :

답변 3

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 54
© SIRSOFT
현재 페이지 제일 처음으로