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

Cli task database save

Hi,

(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

Alex



8.1k

Check the privileges of database user.



8.2k

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



6.6k

Can you provide some code?



8.2k

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 ;)



1.1k
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.

Anyone?

EDIT:

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.