Warning: mysqli_fetch_assoc () expects parameter 1 to be mysqli_result, boolean given
I already tested fetch_array
, fetch_object
, I do not know how to do it.
function pegaId($nomeConteudo){
$query = "select id from conteudo where nomeConteudo = {$nomeConteudo} ";
$resultado = mysqli_query($this->conexao, $query);
$value = mysqli_fetch_assoc($resultado);
return $value;
}
I just want to get the ID value, but it does not return me. How to do?
-
The proposed solution did not fit my problem, although it did not return any more errors in this new way:
function pegaId($nomeConteudo){
$query = "select id from conteudo where nomeConteudo = {$nomeConteudo} ";
//$resultado = mysqli_query($this->conexao, $query);
$resource = mysqli_query($this->conexao, $query);
return $resource;
}
It does not return any value here:
$id = $conteudo_fkid->pegaId($nomeConteudo);
echo $id;
So I still need to do a select, and I'm not getting it. How to proceed?