note 30734 added to function.mysql-query
| From: | i5ao at rack1 dot php dot net | Date: | Thu, 27 Mar 2003 02:04:44 +0000 |
| Subject: | note 30734 added to function.mysql-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45874@lists.php.net to get a copy of this message | ||
regarding INSERT/UPDATE optimization comment at "05-Apr-2002 11:39"...
just use REPLACE instead of SELECT, if/then INSERT or UPDATE, if the SELECT is on a primary key.
The number of affected rows will be 1 if the dated was INSERTED, or 2 if UPDATED.
Easier, and probably faster.
:)
--
http://www.php.net/manual/en/function.mysql-query.php
http://master.php.net/manage/user-notes.php?action=edit+30734
http://master.php.net/manage/user-notes.php?action=delete+30734
http://master.php.net/manage/user-notes.php?action=reject+30734