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

nested

Thread began 10/20/2019 6:37 pm by rayne202093 | Last modified 10/21/2019 3:40 pm by Ray Borduin | 38 views | 4 replies |

rayne202093

nested

I have a nested repeat region that was converted using databridge. The code produced is:

<?php
$master1events = new WA_MySQLi_RS("master1events",$clarion_i,0);
$master1events->setQuery("SELECT * FROM (events LEFT OUTER JOIN eventsDate ON events.events_ID=eventsDate.event_IDfk) GROUP BY event ORDER BY eventsDate.eventDate ASC LIMIT 0, 20");
$master1events->execute();
?>
<?php
$detail2eventsDate = new WA_MySQLi_RS("detail2eventsDate",$clarion_i,1);
$detail2eventsDate->setQuery("SELECT * FROM eventsDate WHERE event_IDfk=123456789 ORDER BY eventsDate.eventDate ASC ");
$detail2eventsDate->execute();
?>




<table border="0" cellpadding="0" cellspacing="0">
<?php
$wa_startindex = 0;
while(!$master1events->atEnd()) {
$wa_startindex = $master1events->Index;
?>
<tr>
<td><p class="event-title"><?php echo $master1events->getColumnVal('eventimg'); ?> <?php echo $master1events->getColumnVal('event'); ?></p>
<p class="event-desc"><?php echo $master1events->getColumnVal('desc_front'); ?></p></td>
</tr>
<?php
if ($master1events->TotalRows>0) {
$nested_query_detail2eventsDate = str_replace("123456789", $master1events->getColumnVal('events_ID'), $query_detail2eventsDate);
mysql_select_db($database_clarion);
$detail2eventsDate = mysql_query($nested_query_detail2eventsDate, $clarion) or die(mysql_error());
$row_detail2eventsDate = mysql_fetch_assoc($detail2eventsDate);
$detail2eventsDate->TotalRows = mysql_num_rows($detail2eventsDate);
$nested_sw = false;
if (isset($row_detail2eventsDate) && is_array($row_detail2eventsDate)) {
do { //Nested repeat
?>
<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') != null) {
?>
<a href="<?php echo $detail2eventsDate->getColumnVal('link'); ?>">Read more</a>

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

| <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
} while ($row_detail2eventsDate = mysql_fetch_assoc($detail2eventsDate)); //Nested move next
}
}
?>
<tr>
<td>&nbsp;</td>
</tr>
<?php
$master1events->moveNext();
}
$master1events->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>
</table>

The code does not work. Do I have to change the way the second recordset is setup? Maybe change event_IDfk=123456789?

Thanks for any help.

Sign in to reply to this post

Ray BorduinWebAssist

This section is still in mySQL... Because it was hand-coded, it can't be updated by the extension:

php:
<?php

if ($master1events->TotalRows>0) {
$nested_query_detail2eventsDate str_replace("123456789"$master1events->getColumnVal('events_ID'), $query_detail2eventsDate);
mysql_select_db($database_clarion);
$detail2eventsDate mysql_query($nested_query_detail2eventsDate$clarion) or die(mysql_error());
$row_detail2eventsDate mysql_fetch_assoc($detail2eventsDate);
$detail2eventsDate->TotalRows mysql_num_rows($detail2eventsDate);
$nested_sw false;
if (isset(
$row_detail2eventsDate) && is_array($row_detail2eventsDate)) {
do { 
//Nested repeat
?>
<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') != null) {
?>
<a href="<?php echo $detail2eventsDate->getColumnVal('link'); ?>">Read more</a>

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

| <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
} while ($row_detail2eventsDate mysql_fetch_assoc($detail2eventsDate)); //Nested move next
}
}
?>



I think it should be something like:

php:
<?php

if ($master1events->TotalRows>0) {
$nested_query_detail2eventsDate str_replace("123456789"$master1events->getColumnVal('events_ID'), $query_detail2eventsDate);
?>
<?php
$detail2eventsDate 
= new WA_MySQLi_RS("detail2eventsDate",$clarion_i,1);
$detail2eventsDate->setQuery($nested_query_detail2eventsDate);
$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
}
?>
Sign in to reply to this post

rayne202093

Thank you for the help. I get an error "Notice: Undefined variable: query_detail2eventsDate" on this line:
$nested_query_detail2eventsDate = str_replace("123456789", $master1events->getColumnVal('events_ID'), $query_detail2eventsDate);

How should I change that line?

Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

Maybe just delete that line and use:

php:
<?php

if ($master1events->TotalRows>0) {
?>
<?php
$detail2eventsDate 
= new WA_MySQLi_RS("detail2eventsDate",$clarion_i,1);
$detail2eventsDate->setQuery("SELECT * FROM eventsDate WHERE event_IDfk= "$master1events->getColumnVal('events_ID') ." ORDER BY eventsDate.eventDate ASC");
$detail2eventsDate->execute();
?>
Sign in to reply to this post

rayne202093

That worked perfectly. 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...