We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Error running insert with NOW()

I have been trying to run the following query:

$user = new Users(); $user->save( [ "name" => $name, "created_at" => NOW(), ] );

When executed I get the following error: Call to undefined function NOW() please can anyone advise.

Thanks

NOW() is a MySQL function, that's why you are getting the PHP error. Use time() or follow @corentin-begne link :)

$user->save( [ "name" => $name, "created_at" => time() ] );