izniburak/pdox

"update" returns "0" if the new data same as the old

ozgurg opened this issue · 2 comments

Hi. I updated a row. The new data same as the old. User did not change the input. (Actually this is not a real update.) So the "update" method returns "0".

Is there any way to disable this functioning off?
I want it to return "true/1" on a successful update, even though the new data is the same as the old data.

Hi @ozgurg ,
As long as I know, This is behaviour of the PDO according to Mysql version.. Update method returns the affected rows. If you have a same data with the old, data is not affected. I can recommend that you can change your condition you used at if block. You should check 'false' value.

@izniburak
I'll try your suggestion, thanks.