我有一个名为'笔记本电脑'的表和名为'Lap_War_Expiry'表内的列。代码运行良好,与之前发布的编辑How to retrieve more than one data in email?一样。但是,代码只能运行45个数据。它应该是100个数据并发送给用户。 (我知道这听起来太多电子邮件了,但在我试图将数据合并到一封电子邮件之前,我需要确保所有数据都是先检索出来的)无法检索表php中的所有行,只有一半检索
我尝试更改下面的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 = "[email protected]";
$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. ";
}
}
?>
代码太多 - 考虑修剪一下 – FaddishWorm
谢谢,我已经编辑过了。 – user2810332