> I would know in what cases "found rows" and "updated rows" could be
> different: what i think is that if i get no error code the two number would
> be the same, but if the update fails (example key violation) the two number
> would be different.

Try this one, for a simple case:

mysql> create table test (id INT not null auto_increment primary key, title char(10));
Query OK, 0 rows affected (0.00 sec)

mysql> insert into test (title) values ("first"),("second"),("third"),("fourth");
Query OK, 4 rows affected (0.00 sec)
Records: 4  Duplicates: 0  Warnings: 0

mysql> select * from test;
+----+--------+
| id | title  |
+----+--------+
|  1 | first  |
|  2 | second |
|  3 | third  |
|  4 | fourth |
+----+--------+
4 rows in set (0.00 sec)

mysql> update test set title = "second" where id > 1;
Query OK, 2 rows affected (0.00 sec)
Rows matched: 3  Changed: 2  Warnings: 0


The query will match THREE rows (id > 1), but only TWO will be affected, 
since one of the matching ones has already the value you wanted to enter.

Hope it helps

Giuseppe Maxia




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to