close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

master / detail repeat loop

Thread began 5/24/2021 1:05 pm by rayne202093 | Last modified 5/25/2021 9:52 am by Ray Borduin | 18 views | 2 replies |

rayne202093

master / detail repeat loop

I have this recordset:
<?php
$master1events = new WA_MySQLi_RS("master1events",$clarion_i,20,0);
$master1events->setQuery("SELECT * FROM (events LEFT OUTER JOIN eventsDate ON events.events_ID=eventsDate.event_IDfk) WHERE events.no_display IS NULL AND eventDate >= CURDATE() AND (canceled IS NULL || canceled = 0) AND (upcoming IS NULL || upcoming = 0) GROUP BY event ORDER BY eventsDate.eventDate ASC");
$master1events->execute();
?>

And this code:

<table border="0" cellpadding="0" cellspacing="0">
<?php
$wa_startindex = 0;
while(!$master1events->atEnd()) {
$wa_startindex = $master1events->Index;
?>
<tr>
<td>

<p class="event-online"><strong><?php echo $master1events->getColumnVal('hp_online'); ?></strong></p>

<p class="event-title"><?php echo $master1events->getColumnVal('eventimg',false); ?> <?php echo $master1events->getColumnVal('event'); ?></p>
<p class="event-desc"><?php echo $master1events->getColumnVal('desc_front'); ?></p></td>
</tr>

<?php
if ($master1events->TotalRows>0) {
?>
<?php
$detail2eventsDate = new WA_MySQLi_RS("detail2eventsDate",$clarion_i,1);
$detail2eventsDate->setQuery("SELECT * FROM eventsDate WHERE eventDate >= CURDATE() AND (canceled IS NULL || canceled = 0) AND (upcoming IS NULL || upcoming = 0) AND event_IDfk= ". $master1events->getColumnVal('events_ID') ." ORDER BY eventsDate.eventDate ASC");
$detail2eventsDate->execute();
?>
<?php
$nested_sw = false;
?>
<?php
while (!$detail2eventsDate->atEnd()) {
?>
<!-- -------------------------------- -->
<tr>
<td><p class="event-para"><strong><?php echo $detail2eventsDate->getColumnVal('location'); ?></strong>: <?php echo $detail2eventsDate->getColumnVal('dateDisplay'); ?>
<?php
// Show IF Conditional region1
if ($detail2eventsDate->getColumnVal('link')) {
?>
<a href="<?php echo $detail2eventsDate->getColumnVal('link'); ?>">Read more</a>

<?php
// Show IF Conditional region1
if ($detail2eventsDate->getColumnVal('regLink')) {
?>

| <a href="<?php echo $detail2eventsDate->getColumnVal('regLink'); ?>">Register</a>

<?php }
// endif Conditional region1
?>
<?php
// Show IF Conditional region5
if ($detail2eventsDate->getColumnVal('online') == 1) {
?>
&nbsp;<em>(Online or In-person)</em>
<?php }
// endif Conditional region5
?>
</p>
<?php }
// endif Conditional region1
?></td>
</tr>
<!-- -------------------------------- -->
<?php
$detail2eventsDate->moveNext();
}
?>
<?php
}
?>
<tr>
<td>&nbsp;</td>
</tr>
<?php
$master1events->moveNext();
}
$master1events->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>
</table>

The master record is repeating as it should but only one detail record is shown beneath each master. So the detail record is not repeating. The part of the code between the <!-- -------------------------------- --> should be repeating.

Can you tell me where I made an error in the code?

Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

This line:
$detail2eventsDate = new WA_MySQLi_RS("detail2eventsDate",$clarion_i,1);

The "1" at the end is the number of rows to return... "0" returns all rows, so you can just change it there manually.

Sign in to reply to this post
Did this help? Tips are appreciated...

rayne202093

That worked. Thank you so much!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...