Updating a row

Looks like it’s the home-brewed wrapper to blame. Making it to keep the state is a sure way to make your code execution a mess.

The preferred remedy would be to throw the whole wrapper away and to use vanilla PDO instead. Or at least to make it return all rows at once instead of fetching rows one by one, if possible.