Jump to content

mailing lists


Porkie

Recommended Posts

in the database you would have a row for the location, lets say you call it `location`, I am assumin gyou knwo mysql here, as you already have a user system.

 

Now the mailing system, I really need to know how much of the mailin gystem is compelteed already. Assuming that you have a mailing system that works fine now. And it is sending messages in a way similar to this.

 

$users = mysql_query("SELECT * FROM `users` ; ");
$message  = 'here is the mail';
while($row = mysql_fetch_assoc($users)){

    mail($row['email'],"TITLE",$message);

}

 

if you made the $message an array depening on the location

 

$users = mysql_query("SELECT * FROM `users` ; ");
$messages = array(
    'england'  =>  'here is the mail for the england',
    'ireland'  =>  'here is the mail for the ireland',
    'scotland'  =>  'here is the mail for the scotland',
    'wales'  =>  'here is the mail for the wales',
    'else'  =>  'here is the mail for everywhere else',
);
while($row = mysql_fetch_assoc($users)){
    if($messages[$row['location']){
        $message = $messages[$row['location']];
}els$message = $messages['else'];e{

}
    mail($row['email'],"TITLE",$message);

}

Link to comment
https://forums.phpfreaks.com/topic/154930-mailing-lists/#findComment-814931
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.