I have created an email which queries my MySQL database for the email distribution list, assigning the email list to the variable $to. It appears that any time I have a hyphen in the email address it messes up and I think it's putting in a hard return after each hyphen so the email list isn't being created correctly. How do I get rid of this problem? Do I need to escape out the hyphen and if so, how? Here's the code that creates the list:
Thanks for any help!
Code:
$query = "SELECT * FROM distribution";
$result = mysql_query($query,$conn);
$list = "";
if ($result<>0)
{
while ($content = mysql_fetch_assoc($result))
{
$list = $list.$content['email'].", ";
$to = substr("$list", 0, -1);
}
}
else
{
echo "No records found";
}
Thanks for any help!