PHP MySQL - ON DUPLICATE KEY UPDATE
| From: | Phillip Terry | Date: | Tue, 19 Jun 2007 14:58:01 +0000 |
| Subject: | PHP MySQL - ON DUPLICATE KEY UPDATE | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-28117@lists.php.net to get a copy of this message | ||
Is there an easy way to overwrite a row (e.g. using replace) if a duplicate key already exists?
For instance, is there something like ON DUPLICATE KEY REPLACE (as opposed to UPDATE)?
Or do I have to:
key_exists = query database for key
if (key_exists){
REPLACE...
}
else{
INSERT...
}
Thank you!
Phillip