Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-11-2012, 05:36 PM   PM User | #1
MaDmiX
Regular Coder

 
Join Date: Feb 2012
Location: Charlotte, NC
Posts: 104
Thanks: 26
Thanked 0 Times in 0 Posts
MaDmiX is an unknown quantity at this point
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
MaDmiX is offline   Reply With Quote
Old 10-11-2012, 05:52 PM   PM User | #2
poyzn
Regular Coder

 
poyzn's Avatar
 
Join Date: Nov 2010
Posts: 265
Thanks: 2
Thanked 61 Times in 61 Posts
poyzn is on a distinguished road
place tr-tag inside the do-loop
__________________
Ushousebuilders.com
poyzn is offline   Reply With Quote
Users who have thanked poyzn for this post:
MaDmiX (10-12-2012)
Old 10-12-2012, 06:17 PM   PM User | #3
MaDmiX
Regular Coder

 
Join Date: Feb 2012
Location: Charlotte, NC
Posts: 104
Thanks: 26
Thanked 0 Times in 0 Posts
MaDmiX is an unknown quantity at this point
Thanks poyzn,

That did the trick.

Ken
MaDmiX is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:17 AM.


Advertisement
Log in to turn off these ads.