2011-11-10 2 views
0

테이블의 레코드를 업데이트하고 싶습니다. 나는 Kohana 3.0과 ORM을 사용하고 있습니다. 내 코드는 다음과 같습니다 -Kohana 3.0의 레코드를 업데이트하는 방법

$photo_sel = $this->where('id','=',$this_photo_id) 
        ->where('user_id','=',$user_id) 
        ->where('is_logo','=','0')->find(); 

     if ($photo_sel->loaded()) {  
      $this->photo_file_name = $photo;     
       parent::save(); 
     } 

하지만 첫 번째 레코드가 업데이트 될 때마다. 대신 $ this_photo_id로 레코드를 선택하고 업데이트하려고합니다.

어떻게하면됩니까?

답변

0

당신이 선택한 레코드를 갱신, 수정 및 이러한 기록을 저장하려면 :

$photo_sel = $this->where('id','=',$this_photo_id) 
        ->where('user_id','=',$user_id) 
        ->where('is_logo','=','0')->find(); 

if ($photo_sel->loaded()) {  
    $photo_sel->photo_file_name = $photo;     
    $photo_sel->save(); 
} 
관련 문제