Welcome Guest, Not a member yet? Register   Sign In
Page is not refresh
#1

[eluser]Adnan1984[/eluser]
hello to all, Here is program code:

In Model
Code:
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
Code:
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




Theme © iAndrew 2016 - Forum software by © MyBB