Forum Moderators: coopster
If any one can help....I have a text list of emails and I have a script which imports the emails and dumps them in MySQL.
The text list of emails gets updated daily, and would like to modify the script so that when it is run it only adds NEW emails to the db. I would like to do this without having to empty the db first.
Is this possible?
Cheers
Chris
You could select all the emails load them into an array and then do insert where not in array though it may be faster to delete and just import them all. This again would depend on the amount of data.
The key to the operation is identifying them as new. You need to look at what you have available and thensee what your options are. I am sure there are more than I have mentioned and probably better as well.
INSERT INTO blah (blah) VALUES ('email'),('email'),('email')....
AFAIK thats the best way to insert multiple records, if you are change "INSERT INTO" to "INSERT IGNORE" and it will insert all new records, without having "IGNORE" and if there is a duplicate in the query it will ignore the whole mysql statemnt.