Good morning,
I use a very simple way to count the number of visits I have to different news. Every time you make a request to the news in MySQL I add a visit, and update the entry in the database.
$statement = $conexion->prepare("SELECT * FROM art WHERE id = :id");
$statement->execute(array(':id' => $id));
$posts = $statement->fetch();
$visitas = $posts['visitas'];
$visitas++;
$statement = $conexion->prepare("UPDATE art SET visitas = :visitas WHERE id = $id");
$statement->execute(array(':visitas' => $visitas));
Working works fine, but since February the values have been reset on 3 occasions. The first one gave me the field visits of all the news to 800, the next two times to 0, today is the last time that has happened to me.
Why is it? I do not understand the reason why it happens, the rest of fields are not altered at all.
The field visits in the database is of type int(11)
.