mysqli_affected_rows will return 0 if you run a UPDATE command with the same variables that already exist
Here is a example
db row from 'test' table
----------
id = 1
name = test
mysqli_query($db,"UPDATE `test` SET `name`='test' WHERE `id`='1'");
$i=mysqli_affected_rows($db);
$i Will Be Zero Or False