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


I' m new in this forum and i have one problem:
I try to do multiple insert with my htm form like this:
<?php $attr = array('id=>sms'); echo form_open('insertsms/journalier',$attr); ?>
           <legend>Informations Générales</legend>
          <span>Institution :&lt;input type="text" name="structure"/&gt;&lt;/span>
           <span>Date :&lt;input type="datetime" name="datesms" id="datesms"/&gt;&lt;/span>
       <table class="dTable" border="none">
            <th>Tranche d'Age</th>
            <th>Nombre de cas</th>
            <th colspan="5">&lt;input type="button" value="Ajouter une ligne" /&gt;&lt;/th>
                <select name="patho[]">
                <option selected="selected" value="patho">Choisissez une pathologie</option>
                            foreach ($patho as $row)
                                  echo "<option value='$row-&gt;idpatho'>" . $row->libpatho . "</option>";
            <td class="test">
                <select name="tranche[]" id="tranche">
                <option selected="selected" value="tranche">Choisissez une tranche Age</option>
                            foreach ($age as $row)
                                  echo "<option value='$row-&gt;idtranche'>" . $row->tranche_age . "</option>";
            <td>&lt;input type="text" name="nbcas[]"/&gt;&lt;/td>
            <td>&lt;input type="button" value="supprimer" /&gt;&lt;/td>
       <td>&lt;input type="submit" value="Enregistrer/Envoyer" name="ok" /&gt;&lt;/td>
            <td>&lt;input type="reset" value="Annuelr" name="cancel" /&gt;&lt;/td>
       &lt;?php echo form_close(); ?&gt;

My Controller:

class insertsms extends CI_Controller {
    function __construct()
  function journalier()
        $this->form_validation->set_message('required', 'Veuillez remplir les champs vides');
          // $this->model_liste->create($data)    
                for ($i=0; $i < count($pathoid); $i++) {
                $message = array(
                $test['result'] = $this->model_liste->getPathologie();
                 $test['result'] = $this->model_liste->getTrancheAge();


My Model:
function create($data)
          $this->db->insert_batch('message', $data);

Error Number: 1136

Column count doesn't match value count at row 3

INSERT INTO `message` () VALUES (), (), ('patho','PHY','PHY'), ('tranche','n1','n4'), ('','21','23')

Filename: /var/www/senedomaine.com/models/model_liste.php

Line Number: 48
this code doesn't work

Some one can help me

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