Ok what I am trying to do is email everyone who has registered so far on the site. There are about 10000 records, but only about 30 have registered yet.
Below is my code:
Code: Select all
<?php
$landps = array("mydb", "localhost", "myuser", "mypass");
$database = $landpsї0];
$host = $landpsї1];
$username = $landpsї2];
$password = $landpsї3];
$table = 'users';
$Subject = trim ($Subject);
$Message = trim ($Message);
$URL = 'http://www.mysite.com/admin/';
mysql_connect ($host,$username,$password) or die ("Failed login.");
mysql_select_db ($database) or die ("Failed to access db.");
$Message = nl2br($Message);
$Message = preg_replace("/((http(s?)://)|(<a href="http://www." target="_blank">www.</a>))(їS.]+)b/i",
"<a href="http$3://$4$5"
target="_blank">$2$4$5</a>", $Message);
$Message = preg_replace("/(їw.]+)(@)(їS.]+)b/i",
"<a href="mailto:$0">$0</a>",
$Message);
$From = 'Chris <chris@yduk.net>';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $From\r\n";
$result = mysql_query("SELECT email FROM users WHERE registered = 1");
while ($row = mysql_fetch_array($result))
{
$recipient = $rowї'email'];
mail ($recipient, $Subject, $Message, $headers) or die ("mail failure.");
}
header("Location: $URL");
?>Is it timing out or what? I don't understand why it won't work, the code looks fine to me.
Any of you pros got an idea?
Cheers,
Chris