MySQL : if exist update, else insert

just use this :

REPLACE INTO table SET field1 = '1', field2 = 'a', field3 = 'xx';

Advertisements