View Single Post
Old 02-10-2005, 09:48 PM  
Dragon Curve
Confirmed User
 
Join Date: Oct 2002
Posts: 252
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.
Dragon Curve is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote