CI 묻고 답하기

제목 select_max 사용중 오류 발생
글쓴이 다클템 작성시각 2013/04/29 15:51:38
댓글 : 1 추천 : 0 스크랩 : 0 조회수 : 15675   RSS
모델 할수는 아래와 같습니다.
단순하게 특정 테이블에서 'ref' 필등의 최대값을 받고 싶은데요
아래 오류가 발생하네요

== 모델 소스 ================================================
 function getRef($tableName){

$this->db->select_max('ref');

$result_set = $this->db->get($tableName);

$thread_array = $result_set->result_array();

 

//$this->db->select_max('age', 'maxRef');

//$query = $this->db->get($tableName);

//$this->db->select_max('ref');

//$this->db->get_where($tableName);

//$query = $this->db->get($tableName);

echo $this->db->last_query();

//print_r($query);

//return $query->ref;

}
=================================================================

==오류 ==========================================================

A PHP Error was encountered

Severity: Notice

Message: Object of class stdClass could not be converted to int

Filename: database/DB_active_rec.php

Line Number: 950

A PHP Error was encountered

Severity: Notice

Message: Object of class stdClass to string conversion

Filename: database/DB_active_rec.php

Line Number: 1641

A PHP Error was encountered

Severity: Notice

Message: Object of class stdClass to string conversion

Filename: database/DB_active_rec.php

Line Number: 164

 다음글 팝업창에서 우편번호 검색 질문 입니다. (6)
 이전글 이미지 처리 질문요!! (6)

댓글

변종원(웅파) / 2013/04/29 16:40:59 / 추천 0
result_array() 대신 row_array()로 해보세요.

$this->db->select_max('ref');

$result_set = $this->db->get($tableName);

$thread_array = $result_set->row_array();

echo $thread_array['ref'];