0
How could I fix my code after counting by printing the value for myself and then splitting it? I’m a beginner in php.
$sql = "SELECT Sum(visitas) AS visitas FROM lp_post";
$visitas_total = mysqli_query($conexao,$sql) or die(mysqli_error($conexao));
if(mysqli_num_rows($visitas_total) <= 0){
echo 'Nenhum resultado foi econtrado';
}else{
$visitas = mysqli_fetch_assoc($visitas_total);
echo '';
}
$visitas_media = mysqli_query($conexao,"SELECT id FROM lp_post")or die(mysqli_error($conexao));
$linhas = mysqli_num_rows($visitas_media);
if($linhas >= '2'){
$media = ceil($visitas/$linhas);
}else{
}
that’s the line of error:
$media = ceil($visitas/$linhas);
and my mistake is:
Fatal error: Unsupported operand types in C: wamp www.
I don’t understand the question. if you’re just printing the media, do
echo $media;
she is not an array.– rray
Good morning thank you. Well I make the call echo in the <Strong>visits, but do not give me the value.
– saulo
where the variable $visits ? is declared in one section appears in a mathematical operation and in another it is treated as array.. it makes no sense
– Daniel Omine
What I see is
$ visitas_total
.– Edilson