Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder MaDmiX's Avatar
    Join Date
    Feb 2012
    Location
    Charlotte, NC
    Posts
    198
    Thanks
    51
    Thanked 0 Times in 0 Posts

    Table repeat region adding extra <tr>

    Hi All,

    I have this code to repeat a table region while records exist in my recordset:
    Code:
    <table width="100%" border="0">
      <tr>
        <?php 
    	$oldAirdate = "";
    	$oldDiscrepType = "";
    	do {
    		$newAirdate =  $row_rstINIactivity['Airdate'];
    		$newDiscrepType = $row_rstINIactivity['DiscrepType'];
    		?>
        <td align="left" width="15%"><?php if ($oldAirdate <> $newAirdate) {echo $row_rstINIactivity['Airdate'];} ?></td>
        <td width="15%">&nbsp;</td>
        <td width="55%">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><?php if ($oldDiscrepType <> $newDiscrepType) {echo $row_rstINIactivity['DiscrepType'] . "'s";} ?></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><?php echo $row_rstINIactivity['DiscrepDetail']; ?></td>
        <td><?php echo $row_rstINIactivity['Description']; ?></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><?php echo $row_rstINIactivity['Resolution']; ?></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><?php echo $row_rstINIactivity['Author']; ?></td>
        <?php
    	$oldAirdate = $row_rstINIactivity['Airdate'];
    	$oldDiscrepType = $row_rstINIactivity['DiscrepType']; 	
    	} 
    	while ($row_rstINIactivity = mysql_fetch_assoc($rstINIactivity)); ?>
      </tr>
    </table>
    The first loop iteration works fine and my table looks good but when it loops through again, the data from my first table column is appearing all the way to the right. When I view the page source it seems that some extra cells are being added, pushing this cell over. Here's part of the page source:

    Code:
    <table width="100%" border="0">
      <tr>
            <td align="left" width="15%">2011-10-04</td>
        <td width="15%">&nbsp;</td>
        <td width="55%">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>Equipment issue's</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>VTR6</td>
        <td>@ 8:30 AM VTR 6 had a head clog causing the program JM9422 to ripple on Air.</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>Operator punched up Black and ejected JM9422 out of VTR 6 and switched it to VTR 5 and hot punched VTR 5 to Air. As a result of the transition INI expereinced Approx 20 sec of black on Air. To correct the timing descripnacy operator deleted 20 sec  promo 52500028. Also operator cleaned VTR 6 for future airing and notified engineering and  Supervisor.</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td></td>
            <td align="left" width="15%">2011-10-08</td>
        <td width="15%">&nbsp;</td>
        <td width="55%">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>Media issue's</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>Missing media</td>
        <td>INI Programs VT067 & NWC 1076 are missing for Tuesday</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>Per Scheduling</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td></td>
            <td align="left" width="15%">2011-10-12</td>
        <td width="15%">&nbsp;</td>
        <td width="55%">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
    I don't know what could be causing this. Can anyone help?

    Thanks,

    Ken

  • #2
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    place tr-tag inside the do-loop

  • Users who have thanked poyzn for this post:

    MaDmiX (10-12-2012)

  • #3
    Regular Coder MaDmiX's Avatar
    Join Date
    Feb 2012
    Location
    Charlotte, NC
    Posts
    198
    Thanks
    51
    Thanked 0 Times in 0 Posts
    Thanks poyzn,

    That did the trick.

    Ken


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •