I am working on a web application, and at a point where I submit forms that are unique to the user, a
MySQLIntegrityConstraintViolationException Duplicate entry -'username' for key 'PRIMARY'
I am well aware of why this is being thrown, because I am attempting to enter a duplicate entry into the database with the same primary key. I would appreciate no comments on this, as it might be a redundant.
What I am really asking is how should I handle this. I have attempted to catch this exception, but apparently my lack of experience has caught up to me.
I would appreciate your help with it.
Is there a better method for checking for duplicate entries in a database?
For example, should I do what I do when checking for duplicate members, and just do a check to the database for a matching username and password?
Thanks