"Call to a member function query() on a non-object"

Hello Team,
I had a problem these days in the database of freepbx, I solved some problems but I still have this error

Please can you help me?

Thanks to ALL

Where do you get this error, just by logging in, or trying to perform an action?

when I access the freepbx console web page.

Can you please explain what problems you had, and what you did to solve them?

I restore the database installation and i create asteriskdb. But this problem not repair.
You have a solution?

Best Regards

How did you restore?

uninstalling and reinstalling mysql,

the problem is on this function: