i am selecting company because the company i am writing this for wanted me to print out on a web page all the company names that had gotten mail from the email system.. and i didnt know if i should do a different query for that or if i could leave it in 1 query...
so could i do this: select company, distinct email from members; wasnt sure if that would work right or not... or would i need to do something else for the company print out tnx ----- Original Message ----- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 19, 2003 8:41 PM Subject: Re: [PHP] excluding same field values in mysql In a message dated 2/19/2003 5:22:19 PM Pacific Standard Time, [EMAIL PROTECTED] writes: in the example above i want to only use one of those addresses since they would end up getting 2 emails and that wouldnt look right.. code i have so far is: <?php //connect to db stuff here $query=mysql_query("select company, Email from members"); while($mail=mysql_fetch_array($query)){ mail($mail[Email], $subject, $message, "from: $sender"); echo "mail was sent to: $mail[company] "; } echo "go back to main menu"; ?> works fine except only using an email address 1 time if more than one of the same email.. anybody have any ideas how to fix this? I don't know why you are selecting company, but it you didn't, you could use the following query. select DISTINCT Email from members That would eliminate duplicate email addresses. Janet --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003