How could I fix my code after counting the value for me 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{
}
this is the error line:
$media = ceil($visitas/$linhas);
and my error is:
Fatal error: Unsupported operand types in C: \ wamp \ www.