Can someone help.. i'm not the best with php.. and have been asked by the boss to remove a crapload of emails (listed in a txt file one per line) from a ms access database on the intranet. I have played with mysql and php, and figured something like the following script would work IF it was mysql.. can someone help me with a MS access equivalent?
<?
$db_name = "email_list"; //mysql database
$db_user ="username"; //mysql username
$db_pass = "password"; //mysql password
$unwanted_emails = "emails.txt"; //text file of emails to be removed, one per line
$conn = mysql_connect("localhost",$db_user,$db_pass) or
die ("Could not connect to localhost");
mysql_select_db($db_name, $conn) or
die ("Could not select database ($db_name).");
$email_addrs = file ($unwanted_emails);
$file_length = count($email_addrs);
foreach ($email_addrs as $line_num => $line) {
$query = "delete from emails where email_add = '$line'");
mysql_query($query) or
die(mysql_error());
echo "\"$line\" : <font color=blue>[removed {$line_num} of $file_length]</font>";
}
echo "Total of <b>$file_length</b> emails removed.";
?>