Before generating the next value set your variable to clear or NULL after updating the db, and before updating check whether variable is clear or NULL skip the update process.
Reputation Points: 167
Solved Threads: 239
Nearly a Posting Virtuoso
Offline 1,445 posts
since May 2008