[PHP] Duplicate e-mails

2002-02-17 Thread Anthony Rodriguez

I've a php script that gets e-mail addresses from a MySQL database and then 
sends the same e-mail message to about 100+ addressees. There are no 
duplicate addresses in the db.

When I call the script the e-mails do get send but in duplicate and, 
instead of linking to a Task Done page,  it shows url not found.  There 
is no duplication within the script and the url called is there in the same 
folder as the script.

Is there a problem with php's mail function when it's used for multiple 
messages?  Or is there a processing time limit that makes the script to be 
processed twice?

Scripts are run using Apache under Unix.

Thank you!

Anthony F. Rodriguez
([EMAIL PROTECTED])


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Duplicate e-mails

2002-02-05 Thread Anthony Rodriguez

The following php script sends two (2) e-mails to each addressee.  Why?

?php

$connection=mysql_connect(localhost,wagner,XXX) or die (No 
connection!);

$db=mysql_select_db(sbwresearch,$connection) or die (No database!);

$message= Dear consumer,\n
The following are the online surveys ...  etc.\n;

$qry_1=select * from con_inf;

$result_1=mysql_query($qry_1,$connection) or die (No query # 1!);

while ($row_1=mysql_fetch_array($result_1, MYSQL_ASSOC))

{
$e_mail=$row_1[e_mail];
mail($e_mail,
  News from SBW Research,
  $message,
  From:SBW Research [EMAIL PROTECTED]\n);
};

mysql_free_result($result_1);

mysql_close($connection);

header (location:done.htm);

exit;

?

Anthony Rodriguez
([EMAIL PROTECTED])


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Duplicate e-mails

2002-02-05 Thread Analysis and Solutions

Hi Anthony:

Anthony Rodriguez wrote:
 
 The following php script sends two (2) e-mails to each addressee.  Why?

I'll bet the email addresses in question are listed in the table twice.  Open
up a MySQL command line prompt and enter select * from con_inf; to make
sure.  To keep this from happening, you can delete the duplicates then add a
unique index on the e_mail field in the MySQL table definition.


 $qry_1=select * from con_inf;

Side Issue 1:  why are you selecting everything (via *) rather than just
e_mail, since that's all you're using in the script?


 $result_1=mysql_query($qry_1,$connection) or die (No query # 1!);
 
 while ($row_1=mysql_fetch_array($result_1, MYSQL_ASSOC))
 
 {
 $e_mail=$row_1[e_mail];
 mail($e_mail,

Side Note 2:  You can combiune those two lines into one:
   mail($row_1['e_mail'],


 mysql_free_result($result_1);
 mysql_close($connection);

Side Note 3:  You don't worry about these commands in scripts you're about to
exit anyway.

Enjoy,

--Dan

-- 
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php