Duplicate entry 'root' for key 2

i have this error

DB Error: Duplicate entry ‘root’ for key 2 : DB Error: Duplicate entry ‘root’ for key 2

You are trying to insert a value (‘root’) that already exists in the second unique key you’ve specified when creating the table.

i don’t know how to solve that,

At least two possibilities:

  1. If you need to have duplicate values in that column, get rid of the unique key
  2. if the values in that column must be unique, don’t insert a duplicate value

If the value has to be unique, and the duplicate value comes from user input, then you could show a message to the user when the query returns a duplicate key error.