hello everyone,
i think this a rather complex question but i'll have a go.
i have this output from mysql printed on a php page:
user1
-------------------
week | hours worked | hours had to work | missing hours
32 | 30 | 32 | 2
user2
-------------------
week | hours worked | hours had to work | missing hours
32 | 30 | 32 | 2
and so on.
now that i want is to send an email to the user telling them in what week the missed how many hours.
here is my code sofar:
//mysql stuff
while($row = mysql_fetch_assoc($sql)){
$a = $row['workingtime'];
$b = $row['workedtime'];
if ($a < $b)
{
if($row['username'] != $cat)
echo "<h3>".$row['username']."".$row['useremail']."</h3>\r\n";
echo "<p>working time:".$row['workingtime']."worked time:".$row['workedtime']."Week:".$row['weeknr']."</p>\r\n";
$msg = "<h3>".$row['username']."".$row['useremail']."</h3>"."<p>working time:".$row['workedtime']."working time:".$row['workingtime']."Week:".$row['weeknr']."</p>";
$cat = $row['username'];
}
$to = $row['useremail'];
$subject = "reminder";
$body = "" . $msg . "";
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= 'From: <reminderservice@reminderservice.com>' . "\n";
mail($to, $subject, $body, $headers);
this even sort of works, the only thing i want is to send the user his/her overview of weeks with hours missing.
Now the script is sending an email for every week where hours are missing.
any help is greatly appreciated!