mysql_affected_rows() always returns 1 even though no row was updated.

Posted by happyhardik on Stack Overflow See other posts from Stack Overflow or by happyhardik
Published on 2010-05-15T14:09:21Z Indexed on 2010/05/15 14:14 UTC
Read the original article Hit count: 119

Filed under:
|
|
|
|

What I am trying to do is: (programmatically)

Update status where id is something, if no rows where updated, give error: we cannot find the record with id something, otherwise give message success.

Here I am using mysql_affected_rows() to know if a row was updated or not, but it always return 1, so the user gets a success message, even though there was no row updated.

Can anyone tell me what could it be?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about update