How to deal with CodeIgniter Error Number 1064?
<p>I'm trying to make a login system and I'm getting this database error</p>

<blockquote>
  <p>You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SET <code>last_activity</code> = 1467333267, <code>user_data</code> = 'a:3:{s:9:\"user_data\";s:0:\"\"' at line 1</p>
  
  <p>UPDATE SET <code>last_activity</code> = 1467333267, <code>user_data</code> = 'a:3:{s:9:\"user_data\";s:0:\"\";s:5:\"email\";s:16:\"ocyl28@yahoo.com\";s:12:\"is_logged_in\";i:1;}' WHERE <code>session_id</code> = '570d7ba3d7f11a9a35264ed276368480'</p>
  
  <p>Filename: C:/xampp/htdocs/CodeIgniter/system/database/DB_driver.php</p>
  
  <p>Line Number: 691</p>
</blockquote>

<p>Here is my controller code:</p>

<pre><code>class Template extends CI_Controller {


    public function index()
    {
        $this-&gt;login();
    }   

    public function login()
    {
        $this-&gt;load-&gt;view('Login Template.php');
    }

    public function admin()
    {
        if ($this-&gt;session-&gt;userdata('is_logged_in')) {
            $this-&gt;load-&gt;view('Template 3.php');    
        }
        else {
            echo 'cannot login';
        }   
    }

    public function login_validation()
    {
        $this-&gt;load-&gt;library('form_validation');

        $this-&gt;form_validation-&gt;set_rules('email' , 'Email', 'required|trim|callback_validate_credentials');
        $this-&gt;form_validation-&gt;set_rules('password' , 'Password', 'required|md5|trim');

        if ($this-&gt;form_validation-&gt;run()) {
            $data = array (
                'email' =&gt; $this-&gt;input-&gt;post('email'),
                'is_logged_in' =&gt; 1
                );

            $this-&gt;session-&gt;set_userdata($data);
            redirect('template/admin');
        }
        else 
        {

            echo 'fail';
        }

    }

    public function validate_credentials()
    {
        $this-&gt;load-&gt;model('users');

        if ($this-&gt;users-&gt;can_log_in()) {
            return true;
        }
        else
        {
            $this-&gt;form_validation-&gt;set_message('validate_credentials', 'fail to login');
            return false;
        }
    }



    public function about()
    {
        $this-&gt;load-&gt;view('About this site.php');
    }

    public function logout()
    {
        $this-&gt;session-&gt;sess_destroy();
        redirect('template/login');
    }
</code></pre>

<p>And here is my model code:</p>

<pre><code>class Users extends CI_Model
{

    public function can_log_in()
    {
        $this-&gt;db-&gt;where('email', $this-&gt;input-&gt;post('email'));
        $this-&gt;db-&gt;where('password', md5($this-&gt;input-&gt;post('password')));

        $query = $this-&gt;db-&gt;get('registered_users');

        if ($query-&gt;num_rows() == 1) {
            return true; 
        }
        else 
        {
            return false;
        }
    }
</code></pre>