Reputation: 1
I have an update query in my code - and I want to check if this update REALLY changed any cell - when I try mysqli_affected_rows() - it returns to me that rows were affected/changed, even if they werent.
f.e. when I update value 'test' to the same value 'test' -> it shows me that the row was changed, but I only want to know when it was relly changed (when different value was updated)
How can I achieve that? I'm using mysql and php
Upvotes: 0
Views: 293
Reputation: 26825
Dirty checking is one such strategy. It involves doing the check before you write to the database. This avoids unnecessary round trips to the database.
Process is as follows:
Once all sets have been applied, if the record is dirty, save it.
Upvotes: 1