Crie uma restrição unqie mysql
ALTER TABLE contacts
ADD CONSTRAINT contacts_unique UNIQUE (reference_number);
Bewildered Booby
ALTER TABLE contacts
ADD CONSTRAINT contacts_unique UNIQUE (reference_number);
ALTER TABLE contacts
ADD CONSTRAINT contact_name_unique UNIQUE (last_name, first_name);