2016-10-31 8 views
0

Я не понимаю, как исправить эти коды:Недействительный аргумент для Еогеаспа()

return $this->db->update('slideshow'); 

Я попробовал несколько кодов, как меняется его $query или $query_result и т.д., а ошибка все еще существует. Я до сих пор использовать $this->db->update('');

контроллеры/Cuploadfile.php

function uploadedit() 
{ 

    $data['images'] = ''; // Need to place it here and get images here. 

    //set preferences 
    $config['upload_path'] = './uploads/'; 
    $config['allowed_types'] = 'jpg|gif'; 
    $config['max_size'] = '500000'; 

    //load upload class library 
    $this->load->library('upload', $config); 
    $this->load->model('Mpages'); 


    if (!$this->upload->do_upload('filename')) 
    { 
     // case - failure 
     $upload_error = array('error' => $this->upload->display_errors()); 
     $this->load->view('addslideshows', $upload_error); 
    } 
    else 
    { 
     // case - success 
     $upload_data = $this->upload->data();   
     $filename = $upload_data['file_name']; 
     $image_id = $this->uri->segment(3); 

     $data['images'] = $this->Mpages->edit_slideshow($filename, $image_id); 

     $data['success_msg'] = '<div class="alert alert-success text-center">Your file <strong>' . $upload_data['file_name'] . '</strong> was successfully uploaded!</div>'; 
     $this->load->view('editslideshows', $data); 
    } 
} 

модели/Mpages.php

public function edit_slideshow($filename, $image_id) 
{ 

    $this->db->set('slideshow_image', $filename); 
    $this->db->where('image_id', $image_id); 
    return $this->db->update('slideshow'); 

} 

ответ

0

Изменить функции вашей модели к этому

public function edit_slideshow($filename, $image_id){ 
    $this->db->where('image_id', $image_id); 
    $this->db->update('slideshow', $filename); 

    if($this->db->affected_rows() > 0){ 
     return true; 
    }else{ 
     return false; 
    } 
} 
1

переписать модель

public function edit_slideshow($filename, $image_id) 
{ 
$this->db->set('slideshow_image', $filename); 
$this->db->where('image_id', $image_id); 
$update=$this->db->update('slideshow'); 
if($update) 
{ 
    return true; 
} 
    return false; 
}