I have an administrative panel and in the page of edit the user I receive the data by the form and do the update in the table so that always returns the message of
error Notice: Trying to get property of non-object in C: \ wamp64 \ www \ sondplay \ admin \ process \ proc_edit_user.php on line 25
In my if
I check if there was any change in the lines and if there was the message that the user was modified and redirected to page list users and otherwise displays the message that the user was not successfully edited the error I guess which is not rowCount
my code
<?php
session_start();
include_once("../seguranca.php");
include_once("../conexao.php");
$id = $_POST["id"];
$nome = $_POST["nome"];
$email = $_POST["email"];
$usuario = $_POST["usuario"];
$senha = $_POST["senha"];
$nivel_de_acesso = $_POST["nivel_de_acesso"];
/* Delete all rows from the FRUIT table */
$del = $pdo->prepare("UPDATE usuarios set nome ='$nome', email = '$email', login = '$usuario', senha = '$senha', nivel_acesso_id = '$nivel_de_acesso', modified = NOW() WHERE id='$id'");
$del->execute();
$count = $del->rowCount();
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
</head>
<body>
<?php
if ($count->rowCount > 0) {
echo "
<META HTTP-EQUIV=REFRESH CONTENT = '0;URL=../administrativo.php?link=2'>
<script type=\"text/javascript\">
alert(\"Usuário editado com Sucesso.\");
</script>
";
} else {
echo "
<script type=\"text/javascript\">
alert(\"Usuário não foi editado com Sucesso.\");
</script>
";
}
?>
</body>
</html>