I\'m developing an online gallery with voting and have a separate table for pictures and votes (for every vote I\'m storing the ID of the picture and the ID of the voter). The t
The simples explanation is that you had some data added or some votes occured when you was looking at different pages.
I am sure if you would sorte by ID or creation_date this issue would go away.
I.e. there is no issue with your code