title: how to insert user login date and time in db using php codeigniter?
body: <p>I want to insert login date/time in database when user gets login every time.
  <strong>This is my model......</strong></p>
  
  <pre><code>public function login(){
      $this-&gt;db-&gt;where('username',$this-&gt;input-&gt;post('username'));
      $this-&gt;db-&gt;where('password',md5($this-&gt;input-&gt;post('password')));
      $result = $this-&gt;db-&gt;get('auth_user');
      if($result-&gt;num_rows() &gt; 0){
          $result = $result-&gt;row();
          $data = array(
              'id'        =&gt; $result-&gt;id,
              'username'  =&gt; $result-&gt;username,
          );
          $this-&gt;session-&gt;set_userdata($data);
          return true;
      }else{
          return false;
      }
  }
  </code></pre>