Jump to content

Archived

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

pikemsu28

Displaying a Repeat Region

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? 

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites
Thanks for replying sasa,

I tried this but i'm receiving an error:

Parse error: parse error, unexpected ':' in C:\NursingServer\test.php on line 102

[code]if($name != $tmp:name){ //this is line 102 in my code[/code]

Share this post


Link to post
Share on other sites
It's a typo, change that line to...

[code=php:0]if($name != $tmp_name){[/code]


Regards
Huggie

Share this post


Link to post
Share on other sites
[quote author=HuggieBear link=topic=108672.msg438175#msg438175 date=1158772837]
It's a typo, change that line to...

[code=php:0]if($name != $tmp_name){[/code]


Regards
Huggie
[/quote]thanks HuggieBear

Share this post


Link to post
Share on other sites

×

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.