jwk811 Posted September 3, 2008 Share Posted September 3, 2008 Okay well I keep track of every customer that comes to my live chat on my website and it stores their email in a database everytime they come on with their request. There is over a thousand in there from april and I need to know how I can send an email to everyone without sending more than one if they are in the db more than once and many are in 10s of times so I can't have that. Well I know how to send the emails like this I figure.. $emails = "[email protected], [email protected]"; except there will be like a thousand $to = "$emails"; $subject = "Hello"; $message = "Hello"; $headers = "From: [email protected]"; mail($to,$subject,$message,$headers) So to find the $emails variable which will have all the emails separated by commas I will need to SELECT email from database. So what will that give me and what do I need to do, and can I send the email like that with the emails separated by commas or do I need to send each one by itself? Link to comment https://forums.phpfreaks.com/topic/122609-getting-emails-from-database-but-mannyyyy-are-repeats-how-to-send-only-one-each/ Share on other sites More sharing options...
Adam Posted September 3, 2008 Share Posted September 3, 2008 Don't know if it'll work for 100% but could try looking into MySQL's DISTINCT .. for example: "SELECT DISTINCT email FROM yourTable" Adam Link to comment https://forums.phpfreaks.com/topic/122609-getting-emails-from-database-but-mannyyyy-are-repeats-how-to-send-only-one-each/#findComment-633092 Share on other sites More sharing options...
discomatt Posted September 3, 2008 Share Posted September 3, 2008 Distinct will/should work, assuming you've strtolower()'ed e-mails before dumping them into the database. I don't believe DISTINCT is case-insensitive Link to comment https://forums.phpfreaks.com/topic/122609-getting-emails-from-database-but-mannyyyy-are-repeats-how-to-send-only-one-each/#findComment-633098 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.