I want to be able to prevent duplicate SQL text field rows. That is, if row 1 has the name field already defined as \"John Smith\", I don\'t want it to be able to add anothe
Take a look here, you'll need unique.
CREATE UNIQUE INDEX idxname ON tablename (fieldname);
Adding this index will ensure that no duplicate entries for fieldname
field will be recorded into tablename
table.
You will get a MySQL error with the second client. You should handle this in your PHP code, and put up the form again (instead of just displaying the error message).
An other possibility (for more complex sitations) is the LOCK
functionality. If you lock the table before checking and then you insert your record a concurrent operation (in the second browser window) will be delayed until you release the locks. Then the record will be already saved, so the second PHP script will see it and handle the sitation.
DISTINCT
can also be used to select unique rows.
...
select distinct *
from table1
...