> Unless you have a table lock, INSERT has to be before UPDATE, think
UPDATE, UPDATE (both fail), INSERT, INSERT.
> > update
> > if no rows updated
> > insert
> > if duplicate key
> > update
> > if no rows updated goto insert
That is why you have the loop. This is not a problem with above code,
because only one insert succeeds
while the others then do the update.
Andreas