Hello All,
Having a few problems with the code below and wondered if someone could shed some light on it, I have a php script running from a cron that runs every 15 mins the error I am getting tom the cron is
PHP Notice: Undefined variable: rows in /var/www/vhosts/server.com/migration_tracker/staff/5th_email.php on line 9
My code is
<?php
include('config.inc');
$agree_date = $rows['agree_date'];
if ($agree_date > strtotime('2 week')) {
mysql_select_db($dbname);
$sql="SELECT * FROM db, 5th_email WHERE old_mbox_del = '0' AND 1st_email_sent = '1' AND 2nd_email_sent = '1' AND 4th_email_sent = '1' AND 5th_email_sent = '0' AND 6th_email_sent = '0'";
$result = mysql_query($sql) or die(mysql_error());
$count = 1;
while ($rows = mysql_fetch_array ($result)) {
$to = $rows['contact_email'];
$from = "support@domain";
$subject = "Migration Team";
$message = $rows['body'];
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
if ($count % 5 == 0) {
sleep(5);
}
$count++;
}
$sql="UPDATE tracker_db SET 5th_email_sent ='1' WHERE 6th_email_sent ='0' AND 1st_email_sent = '1' AND 2nd_email_sent = '1' AND 4th_email_sent = '1' AND 5th_email_sent = '0' AND old_mbox_del = '0'";
$result=mysql_query($sql);
}
mysql_close();
?>
I think the problem is I havn't declared $agree_dat correctly or havn't selected from the db, could this be the cuase
Cheers
Martin