So, if I understand, the data in the CSV file is correct?
Why don't you just delete all the data in the MySQL table,
then read in the CSV file? MySQL can load data from CSV files.
Otherwise (for instance if the CSV doesn't contain all users),
use the DBI. It has drivers for both MySQL and CSV. Read from
the CSV file, and for each record, do a delete/insert on the
MySQL site.
Abigail | [reply] |
Another option, using the DBI module (check the perldoc DBI for syntax), is read the information in your table, and as long as you read every entry, if the email doesn't exist, do an INSERT statetement, and if it exists and what you want is to update the information, execute an UPDATE statement using the email in the WHERE clause. (check any tutorial on SQL to check the syntax). | [reply] |