Uncaught Error: Call to a member function prepare () on null in [closed]

0

I'm trying to register my client address and it gives the following message:

Uncaught Error: Call to a member function prepare() on null in 

I have no idea what it might be, I query it this way:

$this->Conexao->prepare($sql)->execute()

According to this error it seems to me that it is considering my $ sql variable as null, but I asked to write it on the screen and it is normal. Even because I happen before the registration that is giving this error php does another before.

    
asked by anonymous 01.08.2016 / 21:39

1 answer

1

I found the problem

The reason why this error appeared is as follows. I created a class to be responsible for the contact and the address ie:

class Endereco extends AbsGeral
{
    function __construct()
    {

    }
}

The error was that I instantiated this class like this:

$end = new Endereco;

Being that there was a construct asking for a parameter. I simply removed this construct which should not have existed and worked perfectly. This is the tip if algeum happens through the same thing I passed.

    
01.08.2016 / 22:21