delete row by using id foreach

<td>
                                    <button class="btn btn-danger btn-xs mu_du_bn del_tkts"  data-id="<?=$img->imgid ?>" ><i class="fa fa-trash-o "></i></button>

                                </td>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript">
$(".mu_eu_bn").click(function(){
$("#mu_ed_un").val($(this).parent().parent().children(".mu_td_un").text());
$("#mu_ed_email").val($(this).parent().parent().children(".mu_td_email").text());
});
$(".mu_du_bn").click(function(){
$(this).parent().parent().remove();
});
                
                
            
         $(".del_tkts").click(function(){
           var imgid=$(this).attr('data-id');
           alert(imgid);
          $.ajax({
              url:"<?= base_url('_adlottery/img_deltee')?>",
              type:"POST",
              data:{
                  imgid:imgid
              },
              success:function(data){
                  if(data === 'deleted'){
                       $("#delete_proj"+user_id).fadeOut();
                  }
//                    
                  
              }
          }); 
           
        });
            

image upload

<form method="POST" action="<?=base_url('_adlottery/addimgtxt')?>" enctype='multipart/form-data'>

<input type="text" name="textname" size="20" />
<input type="file" name="userfile" size="20" />

<br /><br />

<input type="submit" value="upload" />

</form>



 public function addimgtxt(){
      $textname = $this->input->post('textname');
        $config['upload_path']          = './uploads/blog_photos/';
                $config['allowed_types']        = 'gif|jpg|png';
                $config['max_size']             = 10000;
                $config['max_width']            = 1024;
                $config['max_height']           = 768;

                $this->load->library('upload', $config);

                if ( ! $this->upload->do_upload('userfile'))
                {
                        $error = array('error' => $this->upload->display_errors());
echo $error;
//                        $this->load->view('upload_form', $error);
                }
                else
                {
                     $blog_image = $this->upload->data();
                   $data = array('usertext'=>$textname,
                                  'userfile' => 'uploads/blog_photos/' . $blog_image['raw_name'] . $blog_image['file_ext']
                );
//                        $data = array('upload_data' => $this->upload->data());
                        $this->db->insert('imgandtext', $data);
//                        $this->load->view('upload_success', $data);
                }
  }