Here’s the whole code…I change $_GET to $_COOKIE and even added a debugging code checking for the cookie…nothing comes up…
<?
$location="localhost";
$username="MyUser";
$password="MyPass";
$database="MyDB";
$conn = mysql_connect($location,$username,$password);
if (!$conn) die ("Could not connect MySQL");
mysql_select_db($database,$conn) or die ("Could not open database");
$limit = 100; //number of records per go
$offset = 0; //starting point in the database to avoid rerunning records
if (!empty($_COOKIE['offset']))
{
echo "getting here
";
$offset = $_COOKIE['offset'];
echo "offset from cookie is $offset
";
$newoffset = $offset+100;
echo "new offset from cookie is $newoffset
";
setcookie("offset",$newoffset); //we increase the count by 100 so we know where to start getting the records from
}
$headers = 'From: From me' . "rn" ;
$headers .= 'Reply-To:
[email protected]' . "rn" ;
$headers .= 'X-Mailer: php/' . phpversion();
$headers .= "MIME-Version: 1.0n"; //send html email (req'd for image)
$headers .= "Content-type: text/html; charset=iso-8859-1n"; //send html email (req'd for image)
$headers .= "X-Priority: 1n";
$headers .= "X-MSMail-Priority: Highn";
//you need values for these values
$your_name = "Me";
$your_email = "
[email protected]";
$headers .= "From: "".$your_name."" <".$your_email.">n";
$result = mysql_query("SELECT distinct(mail1) FROM my_mail LIMIT $offset, $limit");
if(mysql_num_rows($result) > 0)
{
$count = 0;
while ($row = mysql_fetch_array ($result))
{
$to = $row['mail1'];
$subject = "Testing"; //enter your subject here
//enter your message here (use as many lines as required)
$message = "
|
Paragraph!
Get extra cash </fontParagraph
Paragraph
Paragraph***
Some great deals at Paragraph...
|
|
</body";
//$headers .= "Bcc: $to n" //use this to send Blind Carbon Copies (ie each user only sees his address in when sending to multiple emails)
echo "$to
";
mail($to, $subject, $message, $headers);
$count++;
}
echo "Preparing to reload the page to continue emailing the records.";
echo "
Kill the program";
//you were missing the ending ';' on the line above
}else{
echo "myResult=Email Submissions Failed.";
}
?>