How to know if a MySQL UPDATE query fails because information being supplied matches data already in
Posted
by Mike
on Stack Overflow
See other posts from Stack Overflow
or by Mike
Published on 2010-05-08T17:09:21Z
Indexed on
2010/05/08
17:18 UTC
Read the original article
Hit count: 137
mysql
I have a query where the user types a block of text in a textarea field. They are able to save this information in a database. The problem is that if they have not changed the information or if the information matches the data already in the database, I recieve a '0' for affected rows. Usually I display an error that says the query failed when there are no affected rows. How would I 'know' that the 0 affected rows is because the data already exists, so that I can display a more specific error?
© Stack Overflow or respective owner