Re: Beginner question - Preventing Duplicate Entries

2003-03-27 Thread Brian McCain
You could make the column a unique key...that would prevent duplicates from being entered. Then if you want to be able to try inserting duplicates (like if you don't want the query to fail on duplicate attempts), you could do INSERT IGNORE INTO myTable ... Check http://www.mysql.com/doc/en/CREATE_

RE: Beginner question - Preventing Duplicate Entries

2003-03-26 Thread Wynne Crisman
Add a UNIQUE INDEX to the table you are inserting to. You will then get an error if you try to insert a second time with the same values. Alternativly you could use perform a select and then an insert within the same transaction, determining whether something exists in the db before inserting. Th

RE: Beginner question - Preventing Duplicate Entries

2003-03-26 Thread Wynne Crisman
If you wanted to use MyISAM tables and peform an initial select to determine whether you should insert, you could lock the table you would be selecting/insert from. 'LOCK TABLES table_name WRITE' Don't forget to unlock the table when you are done 'UNLOCK TABLES', otherwise you will likely have de