TIP게시판

제목 Active Recode 작성시에 Where 절 문자열 처리
글쓴이 이지포토 작성시각 2012/12/06 15:01:20
댓글 : 2 추천 : 0 스크랩 : 0 조회수 : 11713   RSS

  $this->db->select( 'ie.* );
  $this->db->from($this->table_name.' ie', false);
  $this->db->join('ibtanswermaster iam', 'iam.eCode = ie.eCode', 'left');
  $this->db->join('ibt_peducational ipe', 'ipe.idx=ie.pCode', 'left');
  $this->db->join("ibtcode ic", "ic.code=ipe.aCode", 'left');
  $this->db->join('ibtarea ia', 'ia.aCode=ipe.aCode and ia.bCode=ipe.bCode', 'left');
  $this->db->join('ibtmocktestschedule imtc', 'imtc.mtScheduleCode=ie.mtScheduleCode', 'left');
  $this->db->join('ibtworkbookmaster iwm', 'iwm.iwmIdx=imtc.iwmIdx', 'left');
  $this->db->where('ie.eCode`=`iam.eCode`');
  $this->db->where('ie.eName`=`iam.mName`');



WHERE 조건절 뒤에 문자열 처리가 안되서 여러번 시도중에 성공..
다 아시리라 믿습니다만 저와 같은 실수를 하시지 마시길..

$this->db->where('ie.eCode`=`iam.eCode`');

를 보면

$this->db->where("ie.eCode"="iam.eCode"); (x) --> 에러납니다.
$this->db->where('ie.eCode'='iam.eCode'); (x) --> 역시 에러납니다.

유의하세요. 물결표밑에있는 ` 을 이용하여 = 앞에만 넣어 주었습니다.(홀수개)


 다음글 각 라이브러리별 DB 핸들링 샘풀 (1)
 이전글 hook 을 이용한 layout 설정하기 (2)

댓글

변종원(웅파) / 2012/12/06 16:37:21 / 추천 0
where(조건절, NULL, false); 요래 하시면 에러 안날겁니다.
이지포토 / 2012/12/07 14:48:08 / 추천 0
웅파님 감사~~