MySQLI Nested Repeat
I've done nested repeat regions before, but that was many years ago and never with MySQLI - I was hoping for some help. I have two tables. 1) Articles which include fields id, adate, name, article. 2) Image with fields id, fk (foreign key back to articles), name. Each article can have multiple images.
Query for articles:
$rsArticle = new WA_MySQLi_RS("rsArticle",$connPIW2015_i,10);
$rsArticle->setQuery("SELECT article.id, article.adate, article.name FROM article");
I created a query for images, a repeat region for the articles, another repeat region for the images, then manually moved the images query and repeat regions into the articles repeat region, so the code looks like this.
$rsImages = new WA_MySQLi_RS("rsImages",$connPIW2015_i,0);
$rsImages->setQuery("SELECT images.id, images.fk, images.name FROM images");
<div><?php echo($rsArticle->getColumnVal("adate")); ?>,
<?php echo($rsArticle->getColumnVal("name")); ?>
<p><?php echo($rsImages->getColumnVal("name")); ?></p>
$rsImages->moveFirst(); //return RS to first record
$rsArticle->moveFirst(); //return RS to first record
Not sure where to go from here. The rsImages query needs some sort of WHERE statement, but not sure what that is.
Thanks - Jeff.