We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Cli task database save


(First, sorry for my bad language, i'm french!)

I've got a little problem with a CLI task for some cron jobs. I use bootstrap from Phalcon doc and added db service to connect to my db (mysql). I can read any data from the database, but i can't save datas. If i call save(), update(), create().... it won't have any actions on database, and no error message.

If anyone hase an idea to find where i'm wrong!

Thanks a lot



Check the privileges of database user.


Privileges are good. I've got a webapp using same user


Can you provide some code?


I only used Phalcon since 3 weeks and i sometimes make mistake about some functions. I found my error and it was 100% my fault! Thanks for the answers ;)

edited Mar '18

Reviving this old thread as i have the exact same problem! Alex0910, are you still alive? If so, could you please share with us what your solution was?

Im running CLI task jobs that can SELECT but i cant update or insert. I get no errors, and what is interesting is that mysql actually does increase the autoincrement on the index, but it doesnt create any new rows. As mentioned before this problem only occurs on CLI, it works fine otherwise.



I managed to solve my problem. The isse was that i had opened an earlier transaction that was never commited. Therefore subsequent insert queries were denied. Solved it by simply committing the transaction.