title: PHP/Codeigniter-How can I insert data to multi table with same sql?
body: <p>I want to insert data from my form to multi table at same sql wit PHP-codeigniter framework. There is a some problem I couldn't find it. Please help me about it.</p>
  
  <p>Thank you.</p>
  
  <p>Controller is here: customer.php</p>
  
  <pre><code>...
      public function editprofile(){
  
       $this-&gt;load-&gt;library('form_validation');
        $this-&gt;form_validation-&gt;set_rules('input_email', 'Email Adresi', 'trim|required|min_lenght[6]|max_lenght[25]|valid_email|xss_clean');
        $this-&gt;form_validation-&gt;set_rules('input_birthday', 'Doğum Tarihi', 'trim|required|min_lenght[2]|max_lenght[14]|xss_clean');
        $this-&gt;form_validation-&gt;set_rules('cinsiyet[]', 'Cinsiyet', 'trim|required|min_lenght[6]|max_lenght[20]|matches[input_password2]|xss_clean');
        $this-&gt;form_validation-&gt;set_rules('select_city', 'Şehir', 'trim|required|min_lenght[6]|max_lenght[20]|xss_clean');
        $this-&gt;form_validation-&gt;set_rules('input_phone', 'Telefon Numarası', 'trim|required|min_lenght[2]|max_lenght[14]|xss_clean'); 
        $this-&gt;form_validation-&gt;set_rules('input_comSname', 'Firma Kısa Adı', 'trim|required|min_lenght[2]|max_lenght[14]|xss_clean'); 
        $this-&gt;form_validation-&gt;set_rules('input_comname', 'Firma Tam Adı', 'trim|required|min_lenght[2]|max_lenght[14]|xss_clean'); 
        $this-&gt;form_validation-&gt;set_rules('select_comcity', 'Firma Yeri', 'trim|required|min_lenght[2]|max_lenght[14]|xss_clean'); 
        $this-&gt;form_validation-&gt;set_rules('input_comemail', 'Firma Email Adresi', 'trim|required|min_lenght[6]|max_lenght[25]|valid_email|xss_clean');
        $this-&gt;form_validation-&gt;set_rules('comEmployernum', 'Çalışan Sayısı', 'trim|required|min_lenght[2]|max_lenght[14]|xss_clean');
        $this-&gt;form_validation-&gt;set_rules('input_comsector', 'Firma Sektörü', 'trim|required|min_lenght[2]|max_lenght[14]|xss_clean');
        $this-&gt;form_validation-&gt;set_rules('input_comnumber', 'Telefon Numarası', 'trim|required|min_lenght[2]|max_lenght[14]|xss_clean');
        $this-&gt;form_validation-&gt;set_rules('input_comwebsite', 'Web Sitesi', 'trim|required|min_lenght[2]|max_lenght[14]|xss_clean');
        $this-&gt;form_validation-&gt;set_rules('input_comservice', 'Hizmetler', 'trim|required|min_lenght[2]|max_lenght[14]|xss_clean');
        if($this-&gt;form_validation-&gt;run() == FALSE) {
            if($this-&gt;session-&gt;userdata('logged_in')){
               error_reporting(0);
               $session_data = $this-&gt;session-&gt;userdata('logged_in');
               $data1['email'] = $session_data['email'];
  
                   $this-&gt;load-&gt;view('navbarview', $data1);
               $this-&gt;load-&gt;view('addProfileInf',$data1);
           }else{
               redirect('home', 'refresh');
           }
        }
        else{
      //$id = $_GET['ID'];
           $this-&gt;load-&gt;model('CustomerModel');
  
  
       $result = $this-&gt;CustomerModel-&gt;addProfileInf();
       if($result) {
  
           if($this-&gt;session-&gt;userdata('logged_in')){
               error_reporting(0);
               $session_data = $this-&gt;session-&gt;userdata('logged_in');
               $data1['email'] = $session_data['email'];
               $this-&gt;load-&gt;view('Loginview',array('email' =&gt; $result));
              echo "&lt;div class='alert alert-success'&gt;
        &lt;a href='MusteriEkle.php' type='button' class='close' data-dismiss='alert'&gt;×&lt;/a&gt;
        &lt;strong&gt;Well done!&lt;/strong&gt;Your information was successfully saved ".$result."!&lt;/div&gt;";
                   $this-&gt;load-&gt;view('navbarview', $data1);
               $this-&gt;load-&gt;view('LoginView');
           }else{
               redirect('home', 'refresh');
           }  }     } }...
  </code></pre>
  
  <p>Here is Model: CustomerModel.php</p>
  
  <pre><code>...
  public function addProfileInf () {
      $this-&gt;load-&gt;database();
  $data = array (  
       $email = $this-&gt;input-&gt;post('input_email'),
        $birthday = $this-&gt;input-&gt;post('input_birthday'),
        $cinsiyet =  $this-&gt;input-&gt;post('cinsiyet[]'),
        $city = $this-&gt;input-&gt;post('select_city'),
        $phone = $this-&gt;input-&gt;post('input_phone'),
        $comSname = $this-&gt;input-&gt;post('input_comSname'),
        $comname = $this-&gt;input-&gt;post('input_comname'),
        $comcity = $this-&gt;input-&gt;post('select_comcity'),
        $comemail = $this-&gt;input-&gt;post('input_comemail'),
        $comnum = $this-&gt;input-&gt;post('comEmployernum'),
        $sector = $this-&gt;input-&gt;post('input_comsector'),
        $comnumber = $this-&gt;input-&gt;post('input_comnumber'),
        $website = $this-&gt;input-&gt;post('input_comwebsite'),
        $service = $this-&gt;input-&gt;post('input_comservice'));
  $sql = "INSERT INTO data (city, birthdate) VALUES
            ('".$city."',
             '".$birthday."') INTO genders (cus_gender) VALUES ('".$cinsiyet."') INTO contacts (phone) VALUES ('".$phone."') INTO companies (comSname, comname) VALUES ('".$comSname."', '".$comname."') INTO com_contacts (comcity, comemail, comnumber, comwebsite) VALUES ('".$comcity."', '".$comemail."', '".$comnumber."', '".$website."') INTO com_data (comsector, comservice, comEmployernum) VALUES('".$sector."', '".$service."', '".$comnum."')";
   $result = $this-&gt;db-&gt;query($sql);
   if($this-&gt;db-&gt;affected_rows()=== 1) {
            return $email;
        }
        else {
            echo "Problem inserting user into database";
            return false;
        }
  }...
  </code></pre>
  
  <p>Here is almost view: addProfileInf.php</p>
  
  <pre><code>     ...
       &lt;?php echo validation_errors();?&gt;
                         &lt;?php form_open('customers/editprofile');?&gt;
  .
  .
  .
  &lt;?php form_close();?&gt;
  ...
  </code></pre>
  
  <p>What is the point of problem in this code? There is any error message. I can't post any data I think. Because when I tried to click submit in addProfileInf.php, nothing happened.</p>