I read a few solutions on stack overflow and found this to be the closest to my question:
MySQL "good" way to insert a row if not found, or update it if it is found
Basically, I'm creating an index of words (from websites) and one of my tables is just a primary key (integer id), and a varchar(35) word.
I need to be able to try and insert a new entry (basically, a new word) word into this table. If the word is not present, a new record with it will be added. If it is present, nothing will happen.
What's the best way to get this functionality? "REPLACE INTO" changes my keys which is not desirable - I'd just like it to be a no-op if mysql finds the word is already in the database table.