我想在日历中添加当前和缺席

时间:2018-10-25 14:44:28

标签: php sql

这是我的一些日历代码。现在必须在该日期以下:

class PHPCalendar {

    //... 

    function getWeekDays() {
        $weekLength = $this->getWeekLengthByMonth ();
        $firstDayOfTheWeek = date ( 'N', strtotime ( $this->currentMonthStart ) );
        $weekDays = "";
        for($i = 0; $i < $weekLength; $i ++) {
            for($j = 1; $j <= 7; $j ++) {
                $cellIndex = $i * 7 + $j;
                $cellValue = null;
                if ($cellIndex == $firstDayOfTheWeek) {
                    $this->currentDay = 1;
                }
                if (! empty ( $this->currentDay ) && $this->currentDay <= $this->currentMonthDaysLength) {
                    $cellValue = $this->currentDay;
                    $this->currentDay ++;

                    $weekDays .= '<li '.$class.'>'.$cellValue.'</li>';
                }
            }
        }       
        return $weekDays;       
    }

    //... 

}

这是sql查询:

    $mt = squery("
        SELECT DATE_FORMAT(add, '%m') AS mnth 
        FROM stu 
        WHERE roll_no=7 
            AND att='Present'
    ");
    $da = squery("
        SELECT DATE_FORMAT(add, '%d') AS da 
        FROM stu 
        WHERE roll_no=7 
            AND att='Present'
    ");

这应该怎么做?

0 个答案:

没有答案