title: CodeIgniter display last id
body: <p>I want to display as a value of textbox the last id of my record and then increment it.</p>
  
  <p>This is what I have:</p>
  
  <p><strong>view.php</strong></p>
  
  <pre><code>          &lt;?php 
              $id = $this-&gt;db-&gt;insert_id();
              $newId = $id + 1;
              $data = array(
                      'name'        =&gt; 'customercode',
                      'id'          =&gt; 'inputCustomerCode',
                      'type'        =&gt; 'text',
                      'readonly'    =&gt; 'true',
                      'class'       =&gt; 'form-control',
                      'value'       =&gt; 'CUST0000' . $newId
              );
              echo form_input($data);
              ?&gt;
  </code></pre>
  
  <p>But it's just displaying <strong>CUST00001</strong>? What am I doing wrong in here? Help is much appreciated and needed. Thanks.</p>