[ad_1]
To preserve the integrity of your database you should add a unique constraint to this column in your database and then catch the exception of the violation of this constraint when performing the UPDATE/INSERT query.
[ad_2]
solved Prevent duplicate user from being added to database