On Wed, 2010-09-22 at 15:05 +0530, sivaji j.g wrote:

> I assume this is with an intention of avoiding duplicate records
> inserts. However in my case db_affected_rows() mostly returns 0 though
> a matching row is found in the table. 
> 
> I guess it is because the values being updated is same as values
> already available in the row. 


Yes, as MySQL documentation clearly states:

For UPDATE statements, the affected-rows value by default is the number
of rows actually changed. If you specify the CLIENT_FOUND_ROWS flag to
mysql_real_connect() when connecting to mysqld, the affected-rows value
is the number of rows “found”; that is, matched by the WHERE clause.

http://dev.mysql.com/doc/refman/5.1/en/mysql-affected-rows.html

Reply via email to