D:\host\scoreman.in\aprsadt2024closed\sendformbulk.php

<?php

include('dbconnect.php');

ini_set('max_execution_time', 0); 
//$databaseQuery = 'SELECT appno,sname,email,hashcode FROM applications where (appno BETWEEN 100 and 3254) and order_status = "Success" LIMIT 1748,250';

//$databaseQuery = 'SELECT appno,sname,email,hashcode FROM applications where (appno BETWEEN 3255 and 5362) and order_status = "Success" LIMIT 1511,500';

////$appno=$_GET["app"];

$databaseQuery = 'SELECT appno,sname,email,hashcode FROM applications where (order_status = "Success" or order_status = "Shipped") and ( emailstatus is null or emailstatus ="" ) ';
$result = mysqli_query($con,$databaseQuery) or die('Query failed: ' . mysqli_error());

echo mysqli_num_rows($result);
echo "<table>";
while($row = mysqli_fetch_array($result))
{



$appno=$row["appno"];
$sname=$row["sname"];
$email=$row["email"];
$key=$row["hashcode"];

$content='<html><body><b>Dear Skater '.$sname.',<br/><br/></b><br/>
Your registration is complete.<br/><br/>

You can download your <b>DISTRICT ROLLER SKATING CHAMPIONSHIP 2024 - Entry Form </b> in the following link.<br/>

<a href="https://scoreman.in/aprsadt2024/application.php?appno='.$appno.'&k='.$key.'">Click Here to Print / Download Application Form</a>
<br/></b><br/>
Please contact your District Unit for further details and approval.
<br/><br/>
Thanks & Regards<br/><br/>
APRSA<br/>
rollersportsap.org
</body></html>';

//$to = "jeganonly@gmail.com,krishnamani_k@yahoo.com,vishnuamalraj@yahoo.com";
//$to =$email;
$to =$email.",jeganonly@gmail.com";
//$to ="jeganonly@gmail.com";
$subject = $sname." |Entry Form ".$appno." | AP-DISTRICTS-2024";

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= "From: office@rollersportsap.org" . "\r\n" ;
//$headers .= "Bcc: jeganonly@gmail.com";

$mailres=mail($to,$subject,$content,$headers);

	$qtext='UPDATE applications SET emailstatus="'.$mailres.'" WHERE appno = "'.$appno.'"';
	//	echo $qtext;
		 mysqli_query($con,$qtext) or mysqli_error();
			


echo "<tr><td>".$appno."</td><td>".$sname."</td><td>".$email."</td><td>".$mailres."</td></tr>";

}
echo "</table>";

echo "finished Success";
?>