0 Replies Latest reply on May 9, 2016 9:00 AM by jgarcia@jeproject.gr

    foreach inside a while API PHP

    jgarcia@jeproject.gr

      I have X amount of records that I am displaying in a table. Currently I can display all records in the table, but the table is really long. The problem is that is going to be used in a monitor without scrolling capabilities. I'm trying to divide my table into smaller sets of 8 rows and make as many table as necessary and then have the tables slide using jQuery. I been trying the following:

       

      while ( $counter <= $foundCount) {

       

        $recordParticipantHTML ='<table class="startingResults">';

        $recordParticipantHTML.='<tr><th>Σ/Ε</th><th>ΑΜ</th><th class="alignLeft">ΙΠΠΟΣ<br><span>Sex/Color/Born/Sire</span></th><th class="alignLeft">ΙΠΠΕΑΣ</th><th>ΟΜΙΛΟΣ</th><th>ΚΑΤ.</th></tr>';

        $i=0;

        foreach ($recordsParticipants as $recordParticipant)

        {

        $recordParticipantHTML.='<tr>';

        $recordParticipantHTML.='<td class="tdSmaller">' . $recordParticipant->getField('startingOrderFinal') . '</td>';

        $recordParticipantHTML.='<td>' . $recordParticipant->getField('participant_HORSE::HorseNumber') . '</td>';

        $recordParticipantHTML.='<td class="alignLeft">' . $recordParticipant->getField('participant_HORSE::HorseName') . '<br>';

        $recordParticipantHTML.='<span>' . $recordParticipant->getField('participant_HORSE::HorseGender') . '/';

        $recordParticipantHTML.=$recordParticipant->getField('participant_HORSE::HorseColor') . '/';

        $recordParticipantHTML.=$recordParticipant->getField('participant_HORSE::HorseYOB') . '/';

        $recordParticipantHTML.=$recordParticipant->getField('participant_HORSE::Sire') . '</span></td>';

        $recordParticipantHTML.='<td class="alignLeft">' . $recordParticipant->getField('participant_RIDER::nameCalc') . '</td>';

        $recordParticipantHTML.='<td>' . $recordParticipant->getField('participant_RIDER::club') . '</td>';

        $recordParticipantHTML.='<td>' . $recordParticipant->getField('participant_RIDER::category') . '</td>';

        $recordParticipantHTML.='</tr>';

       

        if (++$i == 8) {

        break 1;

        }

        ++$counter;

        }

        $recordParticipantHTML.='</table>';

        }

       

      Thanks in advance.