Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 当有多个活动时,如何正确完成我的日历?_Php_Mysql - Fatal编程技术网

Php 当有多个活动时,如何正确完成我的日历?

Php 当有多个活动时,如何正确完成我的日历?,php,mysql,Php,Mysql,我需要一些帮助来显示超过1的事件 当前我的日历如下所示: 我已经为每个事件做了一段时间,但我不知道如何告诉PHP做其他事件,而不是像屏幕截图上那样重复相同的事件2或3次 以下是我当前的代码:(每个人只需1个事件即可完美工作) $chresult=mysql\u查询(“从人员中选择*,其中masquer=0按姓氏排序”); $z=0; 而($z='$startmonth'和date\u end='$startmonth'和date\u end $chresult = mysql_query("S

我需要一些帮助来显示超过1的事件

当前我的日历如下所示:

我已经为每个事件做了一段时间,但我不知道如何告诉PHP做其他事件,而不是像屏幕截图上那样重复相同的事件2或3次

以下是我当前的代码:(每个人只需1个事件即可完美工作)

$chresult=mysql\u查询(“从人员中选择*,其中masquer=0按姓氏排序”);
$z=0;
而($z='$startmonth'和date\u end='$startmonth'和date\u end
$chresult = mysql_query("SELECT * FROM personnel WHERE masquer=0 ORDER BY lastname");

$z = 0;
while ($z < mysql_num_rows($chresult)) {
    $lastname = $donnees['lastname'] = mysql_result($chresult, $z, 'lastname');
    $firstname = $donnees['firstname'] = mysql_result($chresult, $z, 'firstname');
    $personnel_id = $donnees['personnel_id'] = mysql_result($chresult, $z, 'personnel_id');

    $abresult = mysql_query("SELECT motif, date_start, date_end FROM absence WHERE personnel_id='$personnel_id' AND date_start>='$startmonth' AND date_end<='$endmonth' ORDER BY id DESC");
    $rowabsence = mysql_fetch_row($abresult);

    $resultcountpersonnelabsent=mysql_query("SELECT COUNT(*) AS nombre FROM absence WHERE personnel_id='$personnel_id' AND date_start>='$startmonth' AND date_end<='$endmonth' ORDER BY id DESC");
    $number=mysql_result($resultcountpersonnelabsent, 0, 'nombre');

    if($number == 0) {

    }
    else {

        echo "<TR>";
        echo "<TD><span class=\"label label-default\">$lastname $firstname</span></TD>";

        $w = 0;
        while ($w < $number) {

            $explode_date_start=explode('-',$rowabsence[1]);

            $explode_date_end=explode('-',$rowabsence[2]);

            $numberofdays = $explode_date_end[2] - $explode_date_start[2];

            $explode_end_month=explode('-',$endmonth);

            $a = 1;
            while ($a < $explode_date_start[2]) {
                echo "<TD></TD>";
                $a++;
            }

            $b = -1;
            while ($b < $numberofdays) {
                echo "<TD bgcolor=\"$color\"></TD>";
                $b++;
            }

            $c = $explode_date_end[2];
            while ($c < $explode_end_month[2]) {
                echo "<TD></TD>";
                $c++;
            }
            $w++;
        }
        echo "</TR>";
    }
    $z++;
}