I have this code and it should add 1 when you open the site but it adds 1 to the current number and doesn't update it. It should update it so the amount of visited can be shown correctly. "Kijkers" is 0 so when I open it it goes to 1 but after that it doesn't update it.
I tried changing some things but no succes.
<?php
include 'db_conn.php';
$find_counts = "SELECT * FROM visitors";
$result = mysqli_query($conn, $find_counts);
while ($row = mysqli_fetch_assoc($result))
{
//Kijkers = 0 in database
$current_counts = $row['Kijkers'];
$new_count = $current_counts + 1;
$update_count = "UPDATE visitors SET Kijkers='$new_count'";
echo $new_count;
}
?>
I expected that it would update it and keep adding 1 on refresh or reloading the page.