我有一个名为“laptop”的表和一个名为“Lap_War_Expiry”的表内的列。代码运行良好,与我在之前的帖子中编辑的内容一样,如何在电子邮件中检索多个数据?. 但是,该代码仅针对 45 个数据运行。它应该是 100 个数据并将电子邮件发送给用户。(我知道这听起来太多电子邮件,但在我尝试将数据合并到一封电子邮件之前,我需要确保首先检索所有数据)
我尝试更改下面的 php.ini 配置,但仍然无法检索所有需要的电子邮件。除了这个,还有什么地方我应该改变的吗?还是我的配置不对?
max_execution_time = 0 ; Maximum execution time of each script, in seconds
max_input_time = 0 ; Maximum amount of time each script may spend parsing request data
;max_input_nesting_level = -1 ; Maximum input variable nesting level
memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)
这是我发送电子邮件的编码:
<?php
//class.phpmailer.php here
// ======== get database data ==================
$link = mysql_connect("localhost","root","");
$database="master_inventory";
mysql_select_db ($database,$link) OR die ("Could not open $database" );
$query2 = 'SELECT Lap_PC_Name, Lap_War_Expiry FROM laptop';
name.
$result1 = mysql_query($query2);
while($row = mysql_fetch_array($result1)) {
$Lap_PC_Name = $row['Lap_PC_Name'];
$Lap_War_Expiry = $row['Lap_War_Expiry'];
$date=$row['Lap_War_Expiry'];
// $date is get from table
$date = date ('d-m-Y')||('d/m/Y') + (7 * 24 * 60 * 60);
$newdate = strtotime ( '+45 days' , strtotime ( $row['Lap_War_Expiry']) ) ;
$newdate = date ( 'd/m/Y' , $newdate );
if ($newdate <45) {
$mail->Username = "myemail@gmail.com";
$mail->Password = "password";
//sent email code is here
if(!$mail->Send())
echo "Message was not sent <br />PHPMailer Error: " . $mail->ErrorInfo;
else
echo "Message has been sent";
}
else {
echo "No PC expired less than 45 days for today. ";
}
}
?>