note 24990 added to function.mysql-info
| From: | carl at NOSPAMthep dot lu dot se | Date: | Fri, 06 Sep 2002 21:44:12 +0000 |
| Subject: | note 24990 added to function.mysql-info | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-36270@lists.php.net to get a copy of this message | ||
This function can be used as a workaround for a misfeature of MySQL: on an UPDATE, rows that
aren't updated _solely because they looked the same before_ will not be seen in
mysql_affected_rows(). This causes problems when you want to use the result of the update to
determine if there's need to do an INSERT. With MySQL you can do an INSERT IGNORE if
there's no risk of if failing because of a duplicate key other than the one used in the UPDATE.
However, if this isn't the case or you want a bit of RDBMS independence, there's no
easy/pretty workaround. I think I'll resort to doing a SELECT to determine the primary key
before doing the update/insert, as using the CVS version of PHP isn't an option for me.
--
http://www.php.net/manual/en/function.mysql-info.php
http://master.php.net/manage/user-notes.php?action=edit+24990
http://master.php.net/manage/user-notes.php?action=delete+24990
http://master.php.net/manage/user-notes.php?action=reject+24990