I am basically trying to create where the end of the month form date = todays date but in this case 22/09/2016 where opmanager is stored in users get that email and foreach opmanager that has the end of the month date as 22/09/2016 send email. The email script i've done is ready to be implemented into the echo
However where the db fetchs two different opmanagers only one manager is getting the email and isn't been sent to foreach opmanager.
The code below:
<?php
include ("../dbconnect.php");
$sql='SELECT * FROM `clients` WHERE endofmonthform="22/09/2016"'; //TODAYS DATE BACK HERE!
$result=mysql_query($sql);
while($row=mysql_fetch_array($result)){
$enddate = $row['endofmonthform']; // End
$startdate = $row['startofmonthform']; // Start
$email = $row['email']; //Email to send email to
$id = $row['id'];
$formlevel = $row['formlevel']; //To update and check formlevel
$sitegroupname = $row['mastersite'];
$manager = $row['opmanager'];
}
$query="SELECT userEmail FROM `users` WHERE userName='".$manager."'";
$resultSet = mysql_fetch_all($query);
foreach ($query as $row) {
echo $row['userEmail']; //Where send email function will be
}
?>
I need it to send an email to each manager