【发布时间】:2015-10-29 08:23:27
【问题描述】:
<!DOCTYPE html>
<html>
<head>
<title>MY Database</title>
</head>
<body>
<?php
$dbcon=mysql_connect("localhost","santu_dbuser","santulan@123") or die("mysql connection error".mysql_error());
mysql_select_db("santu_db",$dbcon) or die("mysql database error".mysql_error());
$qry="SELECT DISTINCT CaseId,eemp_id, MAX(FeedbackDate) from session_feedback_master WHERE added_by like 'USER' GROUP BY CaseId";
$result=mysql_query($qry) or die("mysql query error".mysql_error());
ini_set("SMTP","localhost");
ini_set("smtp_port","25");
ini_set('sendmail_from', 'no.reply@santulan.co.in');
$num=mysql_num_rows($result);
if($num>0)
{
?>
<table border="1px">
<tr>
<td>Case Id</td>
<td>Feedback Date</td>
<td>Emp Id</td>
<td>Email</td>
</tr>
<?php
while($row=mysql_fetch_assoc($result))
{
echo "<tr>";
echo "<td>".$row["CaseId"]."</td>";
echo "<td>".$row["MAX(FeedbackDate)"]."</td>";
echo "<td>".$row["eemp_id"]."</td>";
echo "</tr>";
<!--- for calculation--->
$mydate=new DateTime($row["MAX(FeedbackDate)"]);
$eemp_id=$row["eemp_id"];
echo $eemp_id;
$now=new DateTime('today');
echo "Diffrence in days";
echo $datediff = $now->diff($mydate)->d;
//echo "<br>";
if($datediff>10)
{
echo "we are checking";
$eemp_id=$row["eemp_id"];
$qry="SELECT email FROM end_employee_master where id=".$eemp_id ;
$result1=mysql_query($qry) or die("mysql query error".mysql_error());
$num=mysql_num_rows($result1);
echo $num;
if($result1)
{
while($row=mysql_fetch_array($result1))
{
$eemp_id=$row["eemp_id"];
echo "employee id is". $eemp_id;
echo "<tr>";
echo "<td>".$row[0]."</td>";
//echo "<td>".$row["id"]."</td>";
//$id=$row["id"];
$to = $row[0];
echo " we found mail id".$to;
$subject = "This is subject";
$message = "This is simple text message from santulan regarding you have not "
."replied for the E-counseling chat for last 28 days ";
$from = "no.reply@santulan.co.in";
$header = 'From: '.$from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
$retval = mail($to,$subject,$message,$header);
if( $retval == true )
{
echo "result found";
echo "Message sent successfully from live.... $mail";
}
else
{
echo "Message could not be sent...";
}
echo "</tr>";
echo "no of rows: $num";
echo "Mail is: $mail";
}
}
else
{
echo " no record found";
}
}
else
{
echo "Date difference not greater ";
}
}
}
?>
</table>`enter code here`
</body>
当我将此文件放在 cron 并设置我的邮件 ID 用于警报时,我收到以下 maul 错误:
/home/santu/public_html/cron_job.php:第 1 行:意外标记附近的语法错误
newline' /home/santu/public_html/cron_job.php: line 1:'
当我手动运行该文件时,它运行绝对正确。看起来大部分是一些 html 错误,但我无法得到它。
【问题讨论】: