0
Error while selecting database data.
$rs = $conexao->query("SELECT FROM cadastro WHERE ID_Cliente = '83'");
$row = $rs->fetch_assoc();
echo $row['nome'];
Fatal error: Uncaught Error: Call to a Member Function fetch_assoc() on Boolean in
0
Error while selecting database data.
$rs = $conexao->query("SELECT FROM cadastro WHERE ID_Cliente = '83'");
$row = $rs->fetch_assoc();
echo $row['nome'];
Fatal error: Uncaught Error: Call to a Member Function fetch_assoc() on Boolean in
0
Regarding your question about mysql
and mysqli
. First it is important to know which shape mysql
works in procedural and mysqli
of the object-oriented form. Here you find how to work both ways.
The mistake happens because your query is bringing false
.
Fatal error: Uncaught Error: Call to a Member Function fetch_assoc() on Boolean in
The correct is to do a validation
$sql = "SELECT * FROM `usuario` LIMIT 5";
$query = mysqli_query($con, $sql);
if ($query) {
// Pode fazer assim
while ($usuario = mysqli_fetch_object($query)) {
// Exibe um link com a notícia
echo $usuario->nome . ' - ' . $usuario->email;
echo '<br/>';
}
}
Browser other questions tagged php mysql mysqli
You are not signed in. Login or sign up in order to post.
@Inkeliz has nothing duplicated. Only one entry in the BD.
– Tiago
It’s exactly the same question. Your query is wrong, the
SELECT
is empty, soon returnsfalse
and you want to dofalse->fetch_assoc()
... Change toSELECT *
, for example. It’s exactly @rray’s answer "When you come across the above error, it means that your query failed to know the source of the error". If that’s not duplicated...– Inkeliz
@Inkeliz True. puts, forgot this silly detail... kkkk
– Tiago