Duplicate database entry redirection error page
Hi,
Im trying to set up a system where a user can register for a certain file. I have set up a database where their username and file selection (from a drop down menu) are inserted into a table (made in mysql) upon clicking register. However, I dont want them to be able to register twice for the same thing, i.e. I dont want username + file duplicates. So I have made the username and file fields in my table as primary keys, thus when a none unique entry is made i.e. a duplicate, I want the user to be redirected to an error page telling them their selection is invalid.
Ok, I know you can use the Check New Username feature under server behaviours but the problem is that it only accepts one field to check against - and either choice username or file still redirect me to exception report internal error page - not very user friendly!
Is there a way to get the condition on both username and file via html code or any other means, and redirect to a custom error page to tell the user to try again? Any help would be extremely welcome. Thanks!
|