Error: Trying to get property of non-object

0

I'm learning php and I have the following code whose error I can not figure out:

try{

    $_POST["imagem"] = "";
    if($bd->insert("AGENDA_agenda",$_POST) === true){

        $img = upaImagem();
        $idAgenda = $bd->insert_id;
        if($img == 0 || !$bd->query("update AGENDA_agenda set imagem='$img' where idAGENDA_agenda='$idAgenda'")){
            die("<script type='text/javascript'>
                alert('Evento Cadastrado!\nMas é necessário reenviar a imagem!');
                window.parent.loadConteudo('agenda/agenda.php?acao=ed&idAGENDA_agenda=$idAgenda');
            </script>");
        }

        die("<script type='text/javascript'>
                alert('Evento Cadastrado!');
                window.parent.loadConteudo('agenda/agenda.php?acao=cad');
            </script>");
    }else{  
        $msgErro = $bd->erro();
        if(!empty($msgErro)){
            throw new Exception($bd->erro());
        }
    }
}catch(Exception $e){
    echo "<div class='erro'>".$e->getMessage()."</div>";
}

Could you help me? The error is:

  

'Notice: Trying to get property of non-object in F: \ wamp \ www \ CM4K \ adm \ classes \ class.bd.php on line 105:'

if($this->query($queryCompare)->num_rows > 0){
                $this->seterro("Nome Inválido!");
                return false;
            }
            return $this->query($sql);
    
asked by anonymous 29.12.2017 / 23:57

0 answers