When I try to do a BD search for a login, it returns the following error:
Recoverable fatal error: Object of class mysqli_result could not be converted to string in C: \ xampp \ htdocs \ TCC \ index.php on line 66
I need to pass all these result values to the other page.
if (isset($_POST['entrar']) && $_POST['entrar'] == "login"){
$email = $_POST['email'];
$senha = $_POST['senha'];
if(empty($email) || empty($senha)){
?>
<script type="text/javascript"> alert ('preencha todos os campos');
</script>
<?php
}else{
$query = "SELECT id,nome, adm, email, senha, rua_num, bairro, tel FROM usuarios WHERE email = '$email' AND senha = '$senha' ";
$result = mysqli_query($conn, $query);
$busca = mysqli_num_rows($result);
$linha = mysqli_fetch_assoc($result);
if($busca > 0){
$_SESSION['id'] = $linha['id'];
$_SESSION['nome'] = $linha['nome'];
$_SESSION['rua_num'] = $linha['rua_num'];
$_SESSION['bairro'] = $linha['bairro'];
$_SESSION['email'] = $linha['email'];
$_SESSION['tel'] = $linha['tel'];
$_SESSION['senha'] = $linha['senha'];
echo "$result";
//header('location: logado.php');
//echo "$email - $senha - $nome";
//exit;
}else{
?>
<script type="text/javascript"> alert('usuario ou senha incorretos!');</script>
<?php
}
}
}