I have the code
mysql_query("INSERT INTO authors (author) VALUES ('$rec_fic_author') WHERE NOT EXISTS (SELECT * FROM authors WHERE author='$rec_fic_author')") or die("cannot insert author");
Where authors is the table containing authorID (pk), and author $rec_fic_author is a _POST variable
I'm trying to make it so that when a person is adding an author, the code checks the database for anyone with the same name (under the author column). If not, then add the entry I have author as TEXT, and for some reason, I can't make it unique in phpMyAdmin. I looked into REPLACE and INSERT .. ON DUPLICATE KEY UPDATE, but as I understand they both need the value in question to be a unique/PK value. This is not the case here.
Help?