Jump to content

Displaying a Repeat Region


pikemsu28

Recommended Posts

I'm not sure if this is the right forum but............

Is it possible to display a repeat region that only displays one occurance of a value from one table column and displays all records from other columns?

I have a table that is populated with user submitted information (name, signup date, signup time, etc)

I want a table that will display the data in the "signup" table but only to display one occurance of the person's name and multiple date and time values.

[code]
<table width="100%" cellpadding="2" cellspacing="1" border="1" id="CBT Report">
  <tr id="Labels">
    <th width="10%" align="left" valign="bottom" class="style2">Name</th>
    <th width="10%" align="left" valign="bottom" class="style2">Date</th>
    <th width="8%" align="left" valign="bottom" class="style2">Time</th>
    <th width="12%" align="left" valign="bottom" class="style2">Email</th>
  </tr>
  <?php do { ?>
  <tr class="style2" id="ReportInfo">
      <td width="10%" height="23" valign="top"><?php echo ucwords($row_report['first_name'])." ".ucwords($row_report['last_name']); ?></td> //only want one occurance of this from database
      <td valign="top" width="10%"><?php echo $row_report['date']; ?></td>
      <td valign="top" width="8%"><?php echo $row_report['time']; ?></td>
      <td valign="top" width="12%"><?php echo $row_report['email']; ?></td>
    </tr><?php } while ($row_report = mysql_fetch_assoc($report)); ?>
</table>
[/code]

Any idea on how to accomplish this? 
Link to comment
https://forums.phpfreaks.com/topic/21310-displaying-a-repeat-region/
Share on other sites

try[code]<table width="100%" cellpadding="2" cellspacing="1" border="1" id="CBT Report">
  <tr id="Labels">
    <th width="10%" align="left" valign="bottom" class="style2">Name</th>
    <th width="10%" align="left" valign="bottom" class="style2">Date</th>
    <th width="8%" align="left" valign="bottom" class="style2">Time</th>
    <th width="12%" align="left" valign="bottom" class="style2">Email</th>
  </tr>
  <?php
$tmp_name='';
do { ?>
  <tr class="style2" id="ReportInfo">
<?php
$name = ucwords($row_report['first_name'])." ".ucwords($row_report['last_name']);
if($name != $tmp:name){
?>
<td width="10%" height="23" valign="top"><?php echo ucwords($row_report['first_name'])." ".ucwords($row_report['last_name']); ?></td> //only want one occurance of this from database
<?php
} else echo '<td width="10%" height="23" valign="top">&nbsp;</td>';
$tmp_name = $name;
?>
      <td valign="top" width="10%"><?php echo $row_report['date']; ?></td>
      <td valign="top" width="8%"><?php echo $row_report['time']; ?></td>
      <td valign="top" width="12%"><?php echo $row_report['email']; ?></td>
    </tr><?php } while ($row_report = mysql_fetch_assoc($report)); ?>
</table>[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.