Porkie Posted April 20, 2009 Share Posted April 20, 2009 simple question, when someone signs up to a mailing list, they have to pick where in britain they live, then every month they will be sent an email specialising there location. How could i do that ? cheers Link to comment https://forums.phpfreaks.com/topic/154930-mailing-lists/ Share on other sites More sharing options...
MadnessRed Posted April 20, 2009 Share Posted April 20, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.