In general, the essence is as follows:
through PHP, I take a record out of the database, sorting them by "ASC" view count
SELECT src, name FROM `image` ORDER BY `shows` ASC LIMIT 1
And here I, add this record 1 view
UPDATE `image` SET `shows` = shows + 1 WHERE `id` = :id;
Everything is wonderful, displays 1 entry and adds 1 view to it.
But the problem is this, if I have an img tag in the markup with the wrong src attribute, I have a request to add a view 2 times, and it’s not 1 and 2.
Why it works so - I do not understand.
So if in the markup - adds 1 view
<img src="<?php echo $result['src']; ?>" alt="">
And if it's worth it, it adds 2 views.
<img src="<?php echo $result['src']; ?>" alt=""> <img src="fsdfsd" alt="">
How it works?