I have a field area_code in mysql table by php form. I need the validation & alert when typing the same area code which is already entered and stored in database.
2 Answers
The best way you do is to define a UNIQUE constraint on field area_code on the table.
ALTER TABLE tableName ADD CONSTRAINT tb_UQ UNIQUE (area_code)
if the code was executed and successful, the server will generate an error if you try to enter area_code that is already present on the table.
1 Comment
SS Nath
It working. Thanks. But I need a alert pop-up box in the php form.