Hi there,
I am not certain if this is the correct board, but here goes…
I am attempting to create a mailing list for my subscribers with PHP and MySQL.
I have a table called pb_subscribers, and it has three sections: subscriber_id, subscriber_name, and subscriber_address.
The subscriber_id will not be used when mailing the subscribers, but instead, it is used for when I want to delete a user.
Here’s my code:
$link = 'http://' . $_SERVER['HTTP_HOST'];
while ($row = mysql_fetch_assoc(mysql_query('SELECT * FROM pb_subscribers')) {
$to = $row['subscriber_name'] . '<' . $row['subscriber_address'] . '>';
}
$subject = $site->website_title_1() . " | New Post";
$emessage = "Hey there,\
\
A new post called \\"" . $_POST['title'] . "\\" has been posted on " . $site->website_title_1() . ".\
Go to " . $link . " to see the post!\
\
Thanks,\
Pocket Blogger";
$headers = "From: noone@pocket-blogger_com";
mail($to,$subject,$emessage,$headers);
Basically, I want “$to” to be equaled to all the values in the database, so I can mail the users. But, my code isn’t working… What am I doing wrong, and what can I do to fix this?