coltrane Posted September 14, 2009 Share Posted September 14, 2009 I have the following code which I want to send 100 emails at a time starting at a specific number in the list. I have a form to input the subject, content and start number. The start number aspect does not work, it always starts at 1. Thank you for any help. <?php // Website Contact Form Generator include("open_db.php"); $query = "SELECT * FROM email_list LIMIT " . $_POST['start'] . "100"; $result = mysql_query($query); if (!$result){ die("Database Query Failed: " . mysql_error()); } else { $num = mysql_numrows($result); } $header = "From: JazzInstructors.com<admin@jazzdirectories.com>\n"; $header1 = "Reply To: JazzDirectories.com<admin@jazzdirectories.com>\n"; $Subject = $_POST['subject']; $content = $_POST['content']; while ($row = mysql_fetch_array ($result)){ $first_name=$row['first_name']; $last_name=$row['last_name']; $Emailto = $row['email']; $msg = "Dear $first_name $last_name, \n $content"; mail ($Emailto, $subject, $msg,$header ); } include("close_db.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/174214-send-email-at-a-specific-start-number/ Share on other sites More sharing options...
cbolson Posted September 14, 2009 Share Posted September 14, 2009 Have you confirmed that $_POST["start"] has a value? Also, unless it is in the $_POST value (unlikely) you need a comma between the offset number and the limit: ... LIMIT " . $_POST['start'] . ", 100"; Otherwise it will be read like this (eg where $_POST["start"]=20): ... LIMIT 20100"; Chris Quote Link to comment https://forums.phpfreaks.com/topic/174214-send-email-at-a-specific-start-number/#findComment-918403 Share on other sites More sharing options...
Zane Posted September 14, 2009 Share Posted September 14, 2009 not trying to discourage your mail script or anything but calling the mail() function 100+ times over and over again is just going to freeze your script/server..etc Your best bet is to compile a comma separated list of 100 people at a time if not all of your users and send it all at once as a BLIND CARBON COPY -> Bcc something like this http://www.dreamincode.net/forums/showtopic99812.htm Quote Link to comment https://forums.phpfreaks.com/topic/174214-send-email-at-a-specific-start-number/#findComment-918413 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.