Can not use object of type PDOStatement as array

0

Good afternoon guys, I'm trying to insert into the database, but I'm having a problem

Below is the method with the error next to my query to perform the insert:

public function setData($data)
        {
            $this->setId($data['id']);
            $this->setNome($data['nome']);
            $this->setEmail($data['email']);
            $this->setSenha($data['senha']);  
        }

The error is in the line "$ this-> setData ($ results [0]);"

public function insert()
        {
            $sql = new Sql();

            $results = $sql->query("CALL sp_usuario_insert(:LOGIN, :EMAIL, :PASSWORD)", array(
                ":LOGIN"=>$this->getNome(),
                ":EMAIL"=>$this->getEmail(),
                ":PASSWORD"=>$this->getSenha()
            ));

            if (count($results) > 0) {
                $this->setData($results[0]);
            }

        }

I can not resolve it.

    
asked by anonymous 19.02.2018 / 20:41

0 answers