hello i'm using PHP , Mysqli have a table with 3 fields (( ID , Username , PID )).i want 'PID field' to contain string of 8 unique chars. my solution is to generate the random string in PHP and check if it's exists if it's exists then it will generate another string .is there any better solution that will save processing time like mysql trigger or sth like that?