Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, after some hours of <em>harddebuggin'</em> got it working... :P</p> <p>Same database table structure.</p> <p>My <strong>new</strong> model function:</p> <pre><code>function add_user( $user_data ) { $tbl = $this-&gt;db-&gt;dbprefix('users'); $this-&gt;db-&gt;insert($tbl, $user_data); return !$this-&gt;db-&gt;affected_rows() == 0; } </code></pre> <p>My <strong>new</strong> controller piece of code:</p> <pre><code>$user_data = array( 'nombre' =&gt; $this-&gt;input-&gt;post('nombre'), 'apellidos' =&gt; $this-&gt;input-&gt;post('apellidos'), 'nif' =&gt; $this-&gt;input-&gt;post('nif'), 'direccion' =&gt; $this-&gt;db-&gt;escape($this-&gt;input-&gt;post('direccion')), 'cp' =&gt; $this-&gt;input-&gt;post('cp'), 'poblacion' =&gt; $this-&gt;input-&gt;post('poblacion'), 'provincia' =&gt; $this-&gt;input-&gt;post('provincia'), 'telefono' =&gt; $this-&gt;input-&gt;post('telefono'), 'edad' =&gt; $this-&gt;input-&gt;post('edad'), 'retribucion' =&gt; $this-&gt;input-&gt;post('retribucion'), 'entidad' =&gt; $this-&gt;input-&gt;post('cc_entidad'), 'oficina' =&gt; $this-&gt;input-&gt;post('cc_oficina'), 'dc' =&gt; $this-&gt;input-&gt;post('cc_dc'), 'cc' =&gt; $this-&gt;input-&gt;post('cc_cc'), 'centro' =&gt; $this-&gt;input-&gt;post('centro'), 'email' =&gt; $this-&gt;input-&gt;post('email'), 'especialidad' =&gt; $this-&gt;input-&gt;post('especialidad'), 'parent' =&gt; $this-&gt;session-&gt;userdata('parent') ); // db adding if( $this-&gt;users-&gt;add_user($user_data) ) { // logged in!! } else { // grrr error!! } </code></pre> <p>It looks much pretty now! :)</p> <p>Hope this helps some <em>lost souls</em> to DO NOT construct the AR data array into the model, but the controller.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload