I'm trying to make an if structure that depends on the number of content in an array and apparently it's counting wrong, because regardless of how much content I select it redirects me to the page I've requested in a condition:
else if(isset($_POST['alterar'])){
foreach ($_POST['selecionado'] as $cpf){
$sql = "SELECT * FROM tbl_usuario WHERE cpf = '$cpf'";
$result = mysqli_query($strcon,$sql) or die("<script type='text/javascript'>alert('Erro no acesso aos dados');</script>");
$linhas[] += $result;
}
if(count($linhas) == 1){
echo "<script type='text/javascript'>window.location='cadastro.php';</script>";
}
else{
echo "<script type='text/javascript'>alert('Escolha uma linha apenas');</script>";
}
}