Hi,
So, when you run the update query the first time, you set valor=1. So, "valor" wasn't "1" before this first update, so the database changes and returns 1 changed value (which is correct and what you want)
Then, you run the same update again, set valor=1, but "valor" was already "1" from the previous update query, so you get no modified values. But your code is still dependent on getting a 1 here which is what you'll most likely have to change.
So, assuming what I said above is correct, and your database is MySQL, then this is the correct behavior according to
MySQL's documentation, where it states:
If you set a column to the value it currently has, MySQL notices this and does not update it.
(not sure about other databases, but I'm assuming most will behave the same for performance reasons)
Which means that everything is working correctly, in that only when the value gets actually updated, you get a 1 back.
So you should maybe change your code to not depend on the return value from that update, or maybe even find some other way to completely avoid running the same query twice.
A quick alternative fix: If you also create some sort of "modified" or "last_updated" column with a timestamp, and then always update it along with "valor", since the timestamp for the second update will be different from the first, then the database will really have to update the row, so you should get 1 on both updates.
Hope it helps, good luck