title: Otp is not post in database
body: <p>after user submit mail id otp will be sent to that email id but my code isn't working it post the email id in database but not the otp. Please can any one help?</p>
  <p><b>Controller Code auth.php</b></p>
  <pre><code>public function register()
  {
      $alphabet = '1234567890';
      $otp = array(); //remember to declare $pass as an array
      $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
  
      for ($i = 0; $i &lt; 8; $i++) {
          $n = rand(0, $alphaLength);
          $otp[] = $alphabet[$n];
      }
      $newotp = implode($otp);
      // $data['otp'] = $newotp;
  
  
  
  
      $to = $this-&gt;input-&gt;post('email');
      $subject = &quot;OTP FOR LOGIN&quot;;
      $message = '
                             Dear,  User ,&lt;br&gt; &lt;br&gt;
                             
                              Thanks You For Requesting OTP.&lt;br&gt;&lt;br&gt;
                              Your Username is - ' . $to . ' And &lt;br&gt;&lt;br&gt;
                              Your Password Is - &lt;b&gt;' . $newotp . '&lt;/b&gt; &lt;br&gt;&lt;br&gt;
                             
                              Thank you!&lt;br&gt;&lt;br&gt;  
                              This is an autogenerated email. Please do not reply to this email.
                              
                              &lt;br&gt;&lt;br&gt;
                             
                            ';
      $mail = $this-&gt;Others-&gt;send_email($to, $subject, $message);
      $data = $this-&gt;user_model-&gt;insert('cred', ['email' =&gt; $to], ['otp' =&gt; ($newotp)]);
  
      redirect(base_url() . 'auth/login');
     
  }
  </code></pre>
  <p><b>Model code user_model.php</b></p>
  <pre><code>public function insert($table, $data = array())
  {
  
      $this-&gt;db-&gt;insert('cred', $data);
      
          $afftectedRows = $this-&gt;db-&gt;affected_rows();
          if ($afftectedRows == 1) {
              $id = $this-&gt;db-&gt;insert_id();
              return $id;
          } else {
              return FALSE;
          }
      
  }
  </code></pre>