Search code examples
phpcodeigniterauthenticationion-auth

Call to undefined function now()


I'm using the Ion Auth library for the authentication system in a website I'm working on. It worked without any problem, but since yesterday I'm getting this error:

PHP Fatal error:  Call to undefined function now() in /home/carlo/public_html/website/application/models/ion_auth_model.php on line 996

The code in that line is this:

        $this->db->update($this->tables['users'], array('last_login' => now()), array('id' => $id));

I read that now() is a mysql function and in php you should use date(), but it seems strange to me that in the library there is a non existing function. Any idea what's happening here?


Solution

  • Use Codeigniters date hepler, it will allow you to use now().

    $this->load->helper('date');