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: 153
Solved Threads: 229
Nearly a Posting Virtuoso
Offline 1,398 posts
since May 2008