title: Data update is not working without profile picture
body: <p>In php when I am updating user info into database with profile image then updation is working but when I'm not selecting image then the update is not working.</p>
  
  <p>Here is my controller:</p>
  
  <pre><code>public function editvendor($id = '') {
      $this-&gt;authAdLogin();
  
      if ($id == '') {
  
          redirect(admin_url() . 'vendorlisting');
      } else if ($this-&gt;db-&gt;where('id', $id)-&gt;get('tbl_vendor')-&gt;num_rows() == 0) {
          redirect(admin_url() . 'vendorlisting');
      } else {
  
          $data['vendor_data'] = $this-&gt;db-&gt;where('id', $id)-&gt;get('tbl_vendor')-&gt;result_array();
          $vendor_data = $data['vendor_data'];
  
          $this-&gt;form_validation-&gt;set_rules('contact_name', 'Name', 'trim|xss_clean|required');
          $this-&gt;form_validation-&gt;set_rules('contact_mobile', 'Mobile Number', 'trim|xss_clean|required|numericmin_length[10]|max_length[10]');
  
          $this-&gt;form_validation-&gt;set_rules('contact_land', 'Landline Number', 'trim|xss_clean|numeric');
          $this-&gt;form_validation-&gt;set_rules('contact_email', 'Email', 'trim|xss_clean|required|valid_email');
          $this-&gt;form_validation-&gt;set_rules('incorporation_date', 'Incorporation Date', 'trim|xss_clean|required');
          $this-&gt;form_validation-&gt;set_rules('pancard_no', 'Pan Card', 'trim|xss_clean|required');
          $this-&gt;form_validation-&gt;set_rules('tan_no', 'Tan Number', 'trim|xss_clean|required');
          $this-&gt;form_validation-&gt;set_rules('tin_no', 'Tin Number', 'trim|xss_clean|required');
          $this-&gt;form_validation-&gt;set_rules('service_no', 'Service Number', 'trim|xss_clean|required');
  
  
  
          if ($this-&gt;form_validation-&gt;run() == false) {
  
              $this-&gt;load-&gt;view('admin/header');
              $this-&gt;load-&gt;view('admin/sidemenu');
              $this-&gt;load-&gt;view('admin/editvendor', $data);
          } else {
  
              $id = $vendor_data[0]['id'];
              $upload_dir = './uploads/' . $vendor_data[0]['vendor_id'];
              if (!is_dir($upload_dir)) {
                  mkdir($upload_dir);
              }
              if (isset($_FILES['profile_pic']['name'])) {
  
  
                  $config['upload_path'] = './uploads/' . $vendor_data[0]['vendor_id'];
                  $config['allowed_types'] = 'gif|jpg|png';
                  /* $config['max_size']   = '1000000';
                    $config['max_width']  = '10240000';
                    $config['max_height']  = '7680000'; */
                  $config['file_name'] = "prof_" . rand(1, 5000);
  
                  $this-&gt;load-&gt;library('upload');
  
                  $this-&gt;upload-&gt;initialize($config);
  
                  if (!$this-&gt;upload-&gt;do_upload('profile_pic')) {
                      $error = $this-&gt;upload-&gt;display_errors();
  
                      $this-&gt;session-&gt;set_flashdata('ppic_error', $error);
  
  
                      redirect(admin_url() . 'editvendor');
                  } else {
                      $data = $this-&gt;upload-&gt;data();
                      $prof_pic = $data['file_name'];
                  }
              } else {
  
  
                  $prof_pic = $vendor_data[0]['profile_pic'];
              }
  
  
              $update_data = array(
                  'contact_name' =&gt; $this-&gt;input-&gt;post('contact_name'),
                  'contact_mobile' =&gt; $this-&gt;input-&gt;post('contact_mobile'),
                  'contact_land' =&gt; $this-&gt;input-&gt;post('contact_land'),
                  'contact_email' =&gt; $this-&gt;input-&gt;post('contact_email'),
                  'mailing_address' =&gt; $this-&gt;input-&gt;post('mailing_address'),
                  'incorporation_date' =&gt; $this-&gt;input-&gt;post('incorporation_date'),
                  'pancard_no' =&gt; $this-&gt;input-&gt;post('pancard_no'),
                  'tan_no' =&gt; $this-&gt;input-&gt;post('mailing_address'),
                  'mailing_address' =&gt; $this-&gt;input-&gt;post('tan_no'),
                  'tin_no' =&gt; $this-&gt;input-&gt;post('tin_no'),
                  'service_no' =&gt; $this-&gt;input-&gt;post('service_no'),
                  'web_url' =&gt; $this-&gt;input-&gt;post('web_url'),
                  'business_address' =&gt; $this-&gt;input-&gt;post('business_address'),
                  'other_certificates' =&gt; $this-&gt;input-&gt;post('other_certificates'),
                  'facebook_link' =&gt; $this-&gt;input-&gt;post('facebook_link'),
                  'twitter_link' =&gt; $this-&gt;input-&gt;post('twitter_link'),
                  'linkedin_link' =&gt; $this-&gt;input-&gt;post('linkedin_link'),
                  'googleplus_link' =&gt; $this-&gt;input-&gt;post('googleplus_link'),
                  'about_company' =&gt; $this-&gt;input-&gt;post('about_company'),
                  'industry_segment' =&gt; $this-&gt;input-&gt;post('industry_segment'),
                  'ayurveda' =&gt; $this-&gt;input-&gt;post('ayurveda'),
                  'homeopathy' =&gt; $this-&gt;input-&gt;post('homeopathy'),
                  'unani' =&gt; $this-&gt;input-&gt;post('unani'),
                  'profile_pic' =&gt; $prof_pic,
              );
  
              $this-&gt;db-&gt;where('id', $id);
              $this-&gt;db-&gt;update('tbl_vendor', $update_data);
  
              $this-&gt;session-&gt;set_flashdata('vendor_edit', 'Successfully updated.');
  
              redirect(admin_url() . 'editvendor/' . $id);
          }
      }
  }
  </code></pre>
  
  <p>Please 
  provide any solution.</p>