Skip to main content
Participant
April 4, 2010
Question

Repeat Region in a Repeat Region

  • April 4, 2010
  • 1 reply
  • 464 views

Hi Guys and Gals,

Im in the process of building my portfolio, and im having trouble basically putting a repeat region in a repeat region…. I shall try to explain.

I’ll be having a list of projects 'repeating' down the page, sorted ascending by project_id. 1, 2, 3 etc

At the same time, I will have images being generated from a different db table on the same db. Each image has a project_id according to which project their from. And I want them to be displayed in the same box as its project. Hence needing a second repeat region…

I’ll most likely filter them out using an if statement… its just getting a repeat region inside a repeat region to work which is the problem.

Ive explored nested Repeat Regions in the past, but thats only been from drawing from one db table... so having no luck at the moment.

Any help would be greatly appreciated.

David

This topic has been closed for replies.

1 reply

Participating Frequently
April 4, 2010

Can't you just  join the project and image tables together in your sql statement and use one repeat region?

mannouchAuthor
Participant
April 4, 2010

I would if I had a fixed amount of images per project.

Participant
April 4, 2010

you could just nest a loop inside of a loop.

so lets say I have a filed that seletces users and all the prerequesists are defined inside of a veriable called query. Than i want to select all of there grades

while($getter1 = mysql_fetch_array($query))

{

     echo $geter1['user'];

     echo "<br />";

   

     $select = "select * from gradebook were user='" . $geter1['user'] . "'";

     $run = mysql_query($select)or die(mysql_error());

     $i=1;

     while($getter2 = mysql_fetch_array($run))

     {

          echo "grade" . $i . ": " . $getter2['grade'];

          $i = $i + 1;

     }

}

Now in this situation this would not be the best way to get the grades but it demonstrates nested loops (repeatable region inside a repeatable reigon)like what you want. I do however agree with the other person who posted you should use an SQL Join.