Update visits when opening the site

1

I'm making a function to change the count of visits on my site. The function is this:

function visitas($conexao, $visita) {

    $query = "update visita set visitas= visitas + 1";

    return mysqli_query($conexao, $query);
}

But I do not know how to get him to tell the visitor automatically when viewing my site. Can someone help me? Thank you!

    
asked by anonymous 20.09.2017 / 15:52

2 answers

1
function visitas($conexao, $visita = '') {

    $query = "update visita set visitas= visitas + 1";

    return mysqli_query($conexao, $query);
}

visitas($conexao);
    
20.09.2017 / 16:09
0

Without too many unnecessary twists and turns, just run the query:

$query = "update visita set visitas= visitas + 1"; 
$data = mysqli_query($conexao, $query);
    
20.09.2017 / 16:24