Error while selecting data from the database.
$rs = $conexao->query("SELECT FROM cadastro WHERE ID_Cliente = '83'");
$row = $rs->fetch_assoc();
echo $row['nome'];
Fatal error: Uncaught fetch_assoc () on boolean in
Error while selecting data from the database.
$rs = $conexao->query("SELECT FROM cadastro WHERE ID_Cliente = '83'");
$row = $rs->fetch_assoc();
echo $row['nome'];
Fatal error: Uncaught fetch_assoc () on boolean in
Regarding your question about mysql
and mysqli
. First of all, it is important to know that the mysql
form works procedurally and mysqli
of the object-oriented form. Here you find how to work in both ways .
The error happens because your query is bringing false
.
Fatal error: Uncaught Error: Call to a member function fetch_assoc () on boolean in
The correct thing 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/>';
}
}