I wanted to send an automated email 24hrs before an ppointment is made, and here is the code i wrote but it is first checking the date so not working correctly, please help

$i=0;
while($i<=$num)
{
$row=mysql_fetch_assoc($select);
$ID=$row['ID'];
$d=$row['date'];
$date=date("Y-m-d"); 
$rem=$row['reminder'];
$email=$row['email'];
    if(($rem=='no')&&($d==$date))
    {
        if($row['time']<='24:00:00')
        {
        $headers = "From: [email]johndoe@yahoo.com[/email]";
        mail($email,"Appointment reminder","This is reminder for your appointment with John Doe",$headers);
        mysql_query("update table set reminder='send' where ID=$ID");
        }
    }
$i++;
}
Member Avatar for diafol

24:00:00 does not exist - you get 23:59:59 and then back to 00:00:00

Other than that you'll need to specify where your script is going wrong.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.