2016-01-12 55 views
0

我不知道我在這裏做錯了,但似乎無法更新圖像路徑db。無法在Codeigniter中插入圖像路徑到db

我試圖打印$圖像我控制器和模型,工作正常,但當我看着數據庫它插入單詞'圖像'。

型號:

function update_profile_image($image, $id){ 
    $this->db->set('profile_thumb', $image); 
    $this->db->where('property_ref_id', $id); 
    $this->db->update('vbc_property_images'); 
} 

控制器:

function property_profile_image_update() { 
    $id = $this->uri->segment(3); 
    $image = $this->uri->segment(4); 
    $this->my_listings_model->update_profile_image($id, $image); 
    $this->load->view('property-profile-image-update'); 
} 

網址爲:

http://localhost/admin/dashboard/property-profile-image-update/1/property_image_1.jpg

回答

0
因爲你逝去的 $id作爲第一個參數,同時呼籲在控制器中的 update_profile_image()方法

更改模型的功能

function update_profile_image($id, $image) 

+0

對不起,沒有運氣..是否有可能becoz我有不同的行像image1.jpg,image2.jpg,image3.jpg ...但是,如果它打印爲個人像image2.jpg那麼不應該是這樣的,是嗎? –