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 = "email1@ww.com, $email2@ww.com"; except there will be like a thousand $to = "$emails"; $subject = "Hello"; $message = "Hello"; $headers = "From: me@aol.com"; 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? Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.