0

前の日付が現在の行の日付と等しい場合、表のセルに行スパンを追加しようとしています。日付が表示されないようにしましたが、行スパンを追加するにはまだ必要です。

どんな助けでも大歓迎です。ありがとうございました。

    //Pull Volunteer Opportunities
$getOpps = mysql_query("SELECT id, group_id, group_name, event_date, max_size, day, meeting_time, avaliable_seats FROM occ_schedule WHERE location_id = '".$location."' ORDER BY event_date") or ("Critical Error! Cannot pull volunteer opportunities"); 

if(mysql_num_rows($getOpps) > 0)
    {
    $prevDate = '';

    while($oppData = mysql_fetch_assoc($getOpps))
        {
        //Check registrations
        $checkReg = mysql_query("SELECT COUNT(id) as totalRegistered FROM occ_volunteers WHERE group_id = '".$oppData['group_id']."'") or die("Critical Error! Cannot check registrations.");

        if(mysql_num_rows($checkReg) > 0)
            {
            while($regData = mysql_fetch_assoc($checkReg))
                {
                if($regData['totalRegistered'] > 0)
                    {
                    $totalRegistered = $regData['totalRegistered'];
                    }

                else
                    {
                    $totalRegistered = '0';
                    }
                }
            }

        $altrow = 'class="alt1"';

        $currentDate = $oppData['event_date'];

        $seatsAvailable = ($oppData['avaliable_seats'] - $totalRegistered);

        if($seatsAvailable > 0)
            {
            $link = '<a href="registerNow.php?id='.$oppData['group_id'].'">Volunteer Now</a>';
            }

        else
            {
            $link = 'All spots have been filled.';
            }

        echo '<tr>';


        if($currentDate == $prevDate)
            {
            echo '<td>&nbsp;</td>';
            }

        else
            {
            echo '<td ' . $altrow . '>' . $oppData['day'] .', ' . date("M d", strtotime($oppData['event_date'])) . '</td>';
            }

        echo '
                <td ' . $altrow . '>'.$oppData['meeting_time'] .'</td>
                <td ' . $altrow . '>'.$totalRegistered . ' of ' . $oppData['avaliable_seats'] .' ' . $link . '</td>
             </tr>';

        $prevDate = $currentDate;
        }
    }
4

0 に答える 0