I have a table which takes in a word from the user. I want this to be a unique key and if it is submitted again, I want it to add 1 to the count of the previous instance of the key.
In my MySQL database/table I have sent the field to unique key. Obviously this means there can only be one.
Now when I try add the same word (through a submitted form) I get:
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘wordtest’ for key ‘uniqueword’
Whats the best way to go about this problem? (I want to add 1 to the count instead of getting that error)
Thanks for your reply. It makes sense, but I am not sure how to go about using that info. First off, where does $input come from? My user is inputting through a form.
And where do you suggest I put that code? In save()?