1
I have a query from which when executing it, gives the following error:
Catchable fatal error: Object of class mysqli could not be converted to string
I confess that I never came across this error. All values are passing correctly. The code that is giving this error follows below:
mysqli_query(sprintf($this->conexao, "INSERT INTO cadastro_usuarios VALUES(null,0,'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','A',NOW());",
mysqli_real_escape_string($this->conexao, $nome),
mysqli_real_escape_string($this->conexao, $email),
mysqli_real_escape_string($this->conexao, $dataNascimento),
mysqli_real_escape_string($this->conexao, $endereco),
mysqli_real_escape_string($this->conexao, $telefone),
mysqli_real_escape_string($this->conexao, $celular),
mysqli_real_escape_string($this->conexao, $apelido),
mysqli_real_escape_string($this->conexao, $genero),
mysqli_real_escape_string($this->conexao, $filhos),
mysqli_real_escape_string($this->conexao, $site),
mysqli_real_escape_string($this->conexao, $facebook),
mysqli_real_escape_string($this->conexao, $instagram),
mysqli_real_escape_string($this->conexao, $twitter),
mysqli_real_escape_string($this->conexao, $nomeFoto),
mysqli_real_escape_string($this->conexao, $descricao)));
The object
$this->conexao
must be the typestring
to work. The correct thing would be to remove it.– Valdeir Psr
How careless my Valdeir. In fact he has to stay out of the sprintf. Thank you so much for paying attention to this detail.
– user24136