Welcome Guest, Not a member yet? Register   Sign In
Multiple Insert bug
#3

[eluser]Soltic[/eluser]
Hi, i changed my code Controller and it look this:

Code:
<?php

class insertsms extends CI_Controller {
    
    function __construct()
    {
        parent::__construct();
    }
    
    
  function journalier()
    {
        $this->form_validation->set_rules('structure','Structure','trim|required|xss_clean');
        $this->form_validation->set_rules('patho[]','Patho','trim|required|xss_clean');
        $this->form_validation->set_rules('tranche[]','Tranche','trim|required|xss_clean');
        $this->form_validation->set_rules('nbcas[]');
        $this->form_validation->set_message('required', 'Veuillez remplir les champs vides');
                
        if($this->form_validation->run())
        {
          
           //$structure_id=$this->input->post('structure');
           $date_sms=$this->input->post('datesms');
           $pathoid=$this->input->post('patho');
           $trancheid=$this->input->post('tranche');
           $nb_cas=$this->input->post('nbcas');
          
                for ($i=1; $i < count($pathoid); $i++) {                              
                  $data = array(
                                'structure_id' =>$this->input->post('structure'),
                                'date_sms' =>$this->input->post('datesms'),
                                'pathoid' =>$this->input->post('patho'.$i),
                                'trancheid' =>$this->input->post('tranche'.$i),
                                'nb_cas' =>$this->input->post('nbcas'.$i)
                                 );
               //$this->model_liste->create($data);
              
                 echo "<pre>";  
               print_r($data);
               echo "</pre>";
                    
                    }
                  
                 }
                
           else
            {
                
               $this->template->write_view('nav','navigation');
                $this->template->write_view('logo','logo');
                $this->template->render();
                $test['result'] = $this->model_liste->getPathologie();
                 $test['result'] = $this->model_liste->getTrancheAge();
                $this->load->write_view('content','vue_insertsms',$test);
            }
      
       }
}
?&gt;


And when i print data i have this result:

Array
(
[structure_id] => 221779128978
[date_sms] => 2012/06/17 04:19
[pathoid] =>
[trancheid] =>
[nb_cas] =>
)
Array
(
[structure_id] => 221779128978
[date_sms] => 2012/06/17 04:19
[pathoid] =>
[trancheid] =>
[nb_cas] =>
)
Array
(
[structure_id] => 221779128978
[date_sms] => 2012/06/17 04:19
[pathoid] =>
[trancheid] =>
[nb_cas] =>
)

there are three field without value.

I need help

Thanks


Messages In This Thread
Multiple Insert bug - by El Forum - 06-10-2012, 11:00 AM
Multiple Insert bug - by El Forum - 06-12-2012, 01:52 AM
Multiple Insert bug - by El Forum - 06-17-2012, 09:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB