MYSQL - List of emails, delete rows out of a table?

Assuming you want to use the text file's contents as the source of addresses to delete from the database: $addreses = file('emails. Txt'); foreach($addresses as $address) { $safe_address = mysql_real_escape_string($address); $sql = "DELETE FROM yourtable WHERE (email = '$safe_address');"; $result = mysql_query($sql) or die(mysql_error()); } is the simplest form. You can do some things to optimize the process, such as creating a list of emails in quoted/comma-separated form and using WHERE IN (...) instead, to reduce the number of queries generated/executed Note that I'm using PHP as a pseudo-code placeholder, but the basic principle would be the same in pretty much any language.

Assuming you want to use the text file's contents as the source of addresses to delete from the database: $addreses = file('emails. Txt'); foreach($addresses as $address) { $safe_address = mysql_real_escape_string($address); $sql = "DELETE FROM yourtable WHERE (email = '$safe_address');"; $result = mysql_query($sql) or die(mysql_error()); } is the simplest form. You can do some things to optimize the process, such as creating a list of emails in quoted/comma-separated form and using WHERE IN (...) instead, to reduce the number of queries generated/executed.

Note that I'm using PHP as a pseudo-code placeholder, but the basic principle would be the same in pretty much any language.

1 & Answer: Thanks this is what I was looking for. I'll probably be adjusting this to a BASH shell script. – Mechaflash Oct 4 at 14:16.

Use excel to turn the dataset into a comma separated string and then simply: DELETE FROM YOUR_TABLE WHERE email IN ('example@aol. Com', 'example2@aol. Com') Note that you will need to manually add the single quotes before and after each email address in excel as well.

This would work, except it's a lot of extra work for formatting. – Mechaflash Oct 4 at 14:17.

By using the concatenate function and matching with the list of the selected emails.

D We use open office and not even sure how to do that in the first place. – Mechaflash Oct 4 at 14:17.

You can do some things to optimize the process, such as creating a list of emails in quoted/comma-separated form and using WHERE IN (...) instead, to reduce the number of queries generated/executed. Note that I'm using PHP as a pseudo-code placeholder, but the basic principle would be the same in pretty much any language.

I can't promote illegal sites,but Napster has a payment plan to download now. Feel free to check them out.

The best sight is no sight at all. All the scopes and sights block my view and are a real pain in the ass. Iron sights FTW!

The best sight to is (without quotes):.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions