0

I'm trying to create a page to send emails to contacts in my database. I started by embedding an array in the page and then used a text file, both were successful and now I'm trying to take the information from a database.

$setEmailArray = array ("email@domain.co.uk", "email@domain.com");
for($i = 0; $i < count($setEmailArray); $i++){
mail ($setEmailArray[$i], $subject, $message, $headers);

This is basically the code from the embedded array. I got the following code and I'm not sure where to go with it.

$sql = "SELECT customer_email FROM customer";
$result = mysql_query ($sql, $con );
while( $row = mysql_fetch_row ($result) )
{
  $customer_email[] = $row[1];
}
mysql_free_result( $result );

Any help would be greatly appreciated.

Thanks, Sam.

Edited by s.butler1: grammar

2
Contributors
3
Replies
11
Views
6 Years
Discussion Span
Last Post by s.butler1
0

I don't know how to get the addresses from the array to the emails.
I tried putting $customer_email into the count function and directly into the mail function, I also tried it with $row. None of them worked.

0

Accidentally used fetch_row instead of fetch_array - works now :P

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.