EllisLab text mark
Advanced Search
     
Page is not refresh
Posted: 04 October 2012 01:29 AM   [ Ignore ]
Joined: 2012-09-13
13 posts

hello to all, Here is program code:

In Model

public function get_user($userid){
       $query 
$this->db->get_where('agent' , array('agent_id' => $userid));
       return 
$query->row_array(); 
    
}

public function update_remove($id,$path){   
         $data 
= array(
            
'ext'   => '' 
            
);
       
$this->db->where('agent_id',$id);
 
$this->db->update('agent'$data);
        
        if(
$this->db->affected_rows() >= 1){
            
if(unlink($path)){
                
return TRUE;
            
}else{
                
return FALSE;
            
}
        }
    } 

In Controller

public function remove_image($userid){
            $id 
=  $this->uri->segment(3);
            
            
$this->load->model('admin_model');
            
$data['row']$this->admin_model->get_user($userid);
            
            
            
$path =  realpath(APPPATH.'../uploads/thumbs/'.$data['row']['reference_num'].''.$data['row']['ext']);
            
$this->admin_model->update_remove($id,$path);
      
            
$this->load->view('edit_user_view',$data);
          
    

When i clicked Delete image with link, The image are removed in my folder(Unlink) and database. But the image is still appear in Web page!!!. If i refreshed it, the image is disappear. that should not be happened. Any idea?

Thanks