PHP Fatal error:  Call to a member function prepare() on a non-object in

This error is due to a connection error. After debugging, got the output below:

object(PDOException)#3 (8) {
[“message”:protected]=>
string(107) “SQLSTATE[42000] [1044] Access denied for user

To solve ti, just check your connection credentials.