pikemsu28 Posted September 19, 2006 Share Posted September 19, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/21310-displaying-a-repeat-region/ Share on other sites More sharing options...
sasa Posted September 19, 2006 Share Posted September 19, 2006 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"> </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] Quote Link to comment https://forums.phpfreaks.com/topic/21310-displaying-a-repeat-region/#findComment-94890 Share on other sites More sharing options...
pikemsu28 Posted September 20, 2006 Author Share Posted September 20, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/21310-displaying-a-repeat-region/#findComment-95533 Share on other sites More sharing options...
HuggieBear Posted September 20, 2006 Share Posted September 20, 2006 It's a typo, change that line to...[code=php:0]if($name != $tmp_name){[/code]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/21310-displaying-a-repeat-region/#findComment-95538 Share on other sites More sharing options...
pikemsu28 Posted September 20, 2006 Author Share Posted September 20, 2006 IT WORKED!!!!Thanks Huggie and sasa Quote Link to comment https://forums.phpfreaks.com/topic/21310-displaying-a-repeat-region/#findComment-95586 Share on other sites More sharing options...
sasa Posted September 20, 2006 Share Posted September 20, 2006 [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]RegardsHuggie[/quote]thanks HuggieBear Quote Link to comment https://forums.phpfreaks.com/topic/21310-displaying-a-repeat-region/#findComment-95633 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.