Oh that's great thanks :)
I had hoped that these options would be available for the MySQLi extension by now as coding isn't my strongest point but needs must!
I've also got a nested repeat region that I'm a bit stuck with so while I think I've got the rest of it done, I don't know how to get this bit working so how would I go about this please as so far I just have a repeat region inside an repeat region?
I'm trying to get
<?php
while(!$detail2dogs_i->atEnd()) {
?>
<li><a href="dogpge.php?dog=<?php echo($detail2dogs_i->getColumnVal("dog_ID")); ?>"><?php echo($detail2dogs_i->getColumnVal("dog_titlepre")); ?> <?php echo($detail2dogs_i->getColumnVal("dog_showname")); ?></a></li>
<?php
$detail2dogs_i->moveNext();
}
$detail2dogs_i->moveFirst(); //return RS to first record
?>
to do what
<?php
if ($totalRows_Rs_dog_sec>0) {
$nested_query_detail2dogs = str_replace("123456789", $row_Rs_dog_sec['dogsection_ID'], $query_detail2dogs);
mysql_select_db($database_updates);
$detail2dogs = mysql_query($nested_query_detail2dogs, $updates) or die(mysql_error());
$row_detail2dogs = mysql_fetch_assoc($detail2dogs);
$totalRows_detail2dogs = mysql_num_rows($detail2dogs);
$nested_sw = false;
if (isset($row_detail2dogs) && is_array($row_detail2dogs)) {
do { //Nested repeat
?>
<li><a href="dogpge.php?dog=<?php echo $row_detail2dogs['dog_ID']; ?>"><?php echo $row_detail2dogs['dog_titlepre']; ?> <?php echo $row_detail2dogs['dog_showname']; ?></a></li>
<?php
} while ($row_detail2dogs = mysql_fetch_assoc($detail2dogs)); //Nested move next
}
}
?>
does. I need to filter the nested region to only show results relevant to it's parent value but am lost on how to do that.
The full block of old code is
(Old code)
<?php
mysql_select_db($database_updates, $updates);
$query_Rs_dog_sec = "SELECT dogsection_ID, dogsection_name, dogsection_display, dogsection_displayorder FROM dogsection WHERE dogsection_display = 'Y' ORDER BY dogsection_displayorder ASC";
$Rs_dog_sec = mysql_query($query_Rs_dog_sec, $updates) or die(mysql_error());
$row_Rs_dog_sec = mysql_fetch_assoc($Rs_dog_sec);
$totalRows_Rs_dog_sec = mysql_num_rows($Rs_dog_sec);
mysql_select_db($database_updates, $updates);
$query_detail2dogs = "SELECT dogs.dog_ID, dogs.dog_showname, dogs.dog_titlepre, dogs.dog_titleaf, dogs.dog_sex, dogs.dog_breedID, dogs.dog_sectionID, dogs.dog_owner, dogs.dog_breeder, dogs.dog_display, dogs.dog_displayorder, dogs.dog_sitedog_ID FROM dogs WHERE dogs.dog_sectionID=123456789 AND dogs.dog_owner='Y' AND dogs.dog_display = 'Y' AND dogs.dog_sitedog_ID = 1 ORDER BY dogs.dog_displayorder ASC";
$detail2dogs = mysql_query($query_detail2dogs, $updates) or die(mysql_error());
$row_detail2dogs = mysql_fetch_assoc($detail2dogs);
$totalRows_detail2dogs = mysql_num_rows($detail2dogs);
?>
<?php do { ?>
<!-- open li -->
<li>
<a href="dogsec.php?s=<?php echo $row_Rs_dog_sec['dogsection_ID']; ?>"><?php echo $row_Rs_dog_sec['dogsection_name']; ?></a>
<?php
// Show IF Conditional TopMenuDogSecs
if (@$row_Rs_siteinfomenu['site_menu'] >= "2") {
?>
<!-- open ul -->
<ul>
<?php
if ($totalRows_Rs_dog_sec>0) {
$nested_query_detail2dogs = str_replace("123456789", $row_Rs_dog_sec['dogsection_ID'], $query_detail2dogs);
mysql_select_db($database_updates);
$detail2dogs = mysql_query($nested_query_detail2dogs, $updates) or die(mysql_error());
$row_detail2dogs = mysql_fetch_assoc($detail2dogs);
$totalRows_detail2dogs = mysql_num_rows($detail2dogs);
$nested_sw = false;
if (isset($row_detail2dogs) && is_array($row_detail2dogs)) {
do { //Nested repeat
?>
<li><a href="dogpge.php?dog=<?php echo $row_detail2dogs['dog_ID']; ?>"><?php echo $row_detail2dogs['dog_titlepre']; ?> <?php echo $row_detail2dogs['dog_showname']; ?></a></li>
<?php
} while ($row_detail2dogs = mysql_fetch_assoc($detail2dogs)); //Nested move next
}
}
?>
<!-- close ul -->
</ul>
<?php }
// endif Conditional TopMenuDogSecs
?>
<!-- close li -->
</li>
<?php } while ($row_Rs_dog_sec = mysql_fetch_assoc($Rs_dog_sec)); ?>
so I've now got
(New code)
<?php
$Rs_dog_sec_i = new WA_MySQLi_RS("Rs_dog_sec_i",$updates_i,0);
$Rs_dog_sec_i->setQuery("SELECT dogsection_ID, dogsection_name, dogsection_display, dogsection_displayorder FROM dogsection WHERE dogsection_display = 'Y' ORDER BY dogsection_displayorder ASC");
$Rs_dog_sec_i->execute();
?>
<?php
$detail2dogs_i = new WA_MySQLi_RS("detail2dogs_i",$updates_i,0);
$detail2dogs_i->setQuery("SELECT dogs.dog_ID, dogs.dog_showname, dogs.dog_titlepre, dogs.dog_titleaf, dogs.dog_sex, dogs.dog_breedID, dogs.dog_sectionID, dogs.dog_owner, dogs.dog_breeder, dogs.dog_display, dogs.dog_displayorder, dogs.dog_sitedog_ID FROM dogs WHERE dogs.dog_sectionID=123456789 AND dogs.dog_owner='Y' AND dogs.dog_display = 'Y' AND dogs.dog_sitedog_ID = 1 ORDER BY dogs.dog_displayorder ASC");
$detail2dogs_i->execute();
?>
<?php
while(!$Rs_dog_sec_i->atEnd()) {
?>
<!-- open li -->
<li><a href="dogsec.php?s=<?php echo($Rs_dog_sec_i->getColumnVal("dogsection_ID")); ?>"><?php echo($Rs_dog_sec_i->getColumnVal("dogsection_name")); ?></a>
<?php
// Show IF Conditional TopMenuDogSecs
if ($Rs_siteinfomenu_i->getColumnVal("site_menu") >= "2") {
?>
<!-- open ul -->
<ul>
<?php
while(!$detail2dogs_i->atEnd()) {
?>
<li><a href="dogpge.php?dog=<?php echo($detail2dogs_i->getColumnVal("dog_ID")); ?>"><?php echo($detail2dogs_i->getColumnVal("dog_titlepre")); ?> <?php echo($detail2dogs_i->getColumnVal("dog_showname")); ?></a></li>
<?php
$detail2dogs_i->moveNext();
}
$detail2dogs_i->moveFirst(); //return RS to first record
?>
<!-- close ul -->
</ul>
<?php }
// endif Conditional TopMenuDogSecs
?>
<!-- close li -->
</li>
<?php
$Rs_dog_sec_i->moveNext();
}
$Rs_dog_sec_i->moveFirst(); //return RS to first record
?>
Thanks.