Need my email (php)scritp to send, sleep and deleted (MySQL)records after sendin

      I would like to send emails from my DATABASE. I have a few like 100. I have a simple script that sends emails from my DATABASE. I also have a simple DATABASE. I want to CONNECT to my DB then send 5 emails from the DB, then i want my script to SLEEP for 5 seconds. Finally i want to DELETE the emails sent and have a confirmation email SENT to my account. I need to make this script work together in harmony. I WOULD LIKE TO HAVE THIS SCRIPT WORK, but if you guys think its best to use CRON JOB then tell me how DONT SEND ME OFF TO ANOTHER SITE, IF THATS THE CASE then help me with this script first. THANK YOU

This is want i have thus far:

//connect to database

$query = sprintf(“SELECT * FROM newsletter WHERE received=‘0’ LIMIT 20”);
$numRows = mysql_num_rows($sql); // Added “End Campaign”

$result = mysql_query($query);

$count = 1;
while ($row = mysql_fetch_assoc($result)) {
$email = $row[‘Email’];
mail($email, ‘My Subject’, $message);
if ($count % 5 == 0) {

<?php if ($numRows == 0) { // $numRows is set on line 4 using the existing query $subj = "Newsletter Campaign Has Ended"; $body = "The current newsletter campaign has ended. All have been sent the newsletter."; $hdr = "\r\n"; $hdr .= "Content-type: text/html\r\n"; mail("", $subj, $body, $hdr); } // End Check Section ?> <?php DELETE FROM $row (Mailsent <NOW() - INTERVAL @x MINTUES) AND (state) = ('NONACTIVE') <?[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service