I have a feeling this may be a simple fix, however I'm having trouble searching the existing posts and finding the answer I'm looking for.
I have a simple mysql database that includes id, username, lastname and firstname.
I have a complete PHP solution that lets me search the database, edit and update records, delete records and add records. Great.
So i decided that I needed to fine tune the "add record" process. I don't want there to be any duplicate usernames or for that matter the id should also be unique. So in the mysql table I have made both of those fields "unique".
Great. So now when I add a new record that contains a duplicate username, it doesn't add it, but it appears to the user that the record was added successfully.
I want to return a bit of text that says "sorry, that username already exists" At least the user will know that the "add" process failed and why.
Any ideas?