Hi Guys,
Just an update I manage to get it working and I thought I would share my the code.
<?php
$currentDate = date('Y-m-d'); //this will get the current date ie when this was posted 2107-07-06
$host_name = " ";
$database = " ";
$user_name = " ";
$password = " ";
$dbcon = mysqli_connect($host_name, $user_name, $password, $database); //connect to database
if($dbcon->connect_error) die($dbcon->connect_error);
$remind_query1 = "SELECT * FROM Bridges30 WHERE reminder= '$currentDate' "; //Sql query to find users that reminders dates match current date.
if($run1 = $dbcon->query($remind_query1))
{
$rows = $run1->num_rows;
for ($j = 0; $j < $rows; ++$j)//loop through each user in results and send a reminder email.
{
$run1->data_seek($j);
$row = $run1->fetch_array(MYSQLI_NUM);
$to = $row[4]; //gets the user email address
$subject = "Code 30 Reminder";
$message = "Hi ".$row[1]."\nJust a reminder that your code 30 will expiry on the ".$row[6].",\n"
."Please renew your code\n"."\nThank You"."\nBridges Nursery";
$headers = "From: Bridges Nursery";
mail($to,$subject,$message,$headers);
}
}
?>
hope this helps?