$message_sent = 0;
$text = "";
$proj_discuss = new ProjectDiscuss();
$pd_discuss = new ProjectDiscuss();
$text .= "<h2> <u>Worklog Summary </u></h2>";
foreach ($type as $tp) {
    //select all the  user from project discuss table for the day
    $proj_discuss->query('select DISTINCT(pd.iduser) as iduser,usr.firstname, usr.email from project_discuss pd inner join user usr on usr.iduser=pd.iduser WHERE DATEDIFF(NOW(), date_added) <= 7;');
    //check if any of the user enterd worklog for the day
    if ($proj_discuss->getNumRows() > 0) {
        $text .= "<h3>Total Hours Entered   {$tp} </h3>";
        $text .= "<h4><u> Per Participants:</h4></u>";
        while ($proj_discuss->fetch()) {
            $iduser = $proj_discuss->getData('iduser');
            $name = $proj_discuss->getData('firstname');
            $total_hrs = $pd_discuss->getTotalHoursEnteredByIndividual($iduser, $tp);
            //echo 'sa'.(int)$total_hrs.'<br/>';
            if ($total_hrs != '') {
                $text .= '<b>' . $total_hrs . '</b>  Hrs By ' . $name . '<br/>';
            } else {
                $text .= '<b> 0:00</b>  Hrs  By ' . $name . '.<br/>';
            }
        }
    }
}
//echo $text;
// send mails to the ofuz users with their respective worklog
foreach ($admin_emails as $email) {
    $do_template = new EmailTemplate();
    $do_template->senderemail = "*****@*****.**";
    $do_template->sendername = "Ofuz";