Duplicate entry 127 for key 1

Last night I was coding, I got this error "#1062 - Duplicate entry '127' for key 1 ". (I was writing PHP code and MySQL). Basically I couldn't add any entry to the table in the database, after 2 hours checking line by line the code which I have written, still same error. I sat back and tried to calm down because I was panic, I left the code and concentrated on the error message, "Duplicate", "entry", "127", "key 1". I knew the word in the error message except "127", what is for? Why is here? In the table in the database, the primary key 1 was TINYINT. As soon as I searched in Google, I found that a TINYINT filed can take up to 128 values which in this case already been taken, so the capacity is full. Easily I figure out that the primary key 1 should change to INT, and that’s worked. I wish someone was here to see my face while I was trying to solve this issue and after been solved.


Popular posts from this blog

I solved GCHQ puzzle and this is how I did it

The best way to predict the future is to create it

Why I don't have social media account?