|
Use MySQL 4.1 and you can do it all in one query. I use this for time costly reporting tasks.
INSERT INTO table VALUES ('user', 'text') ON DUPLICATE KEY UPDATE SET text = 'text';
Make sure you have a PRIMARY KEY or UNIQUE KEY on the user field.
Anything under MySQL 4.1 isn't capable of this so you'll have to use multiple queries.
|