Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

Repeat Region in a Repeat Region

New Here ,
Apr 04, 2010 Apr 04, 2010

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

TOPICS
Server side applications
478
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 04, 2010 Apr 04, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 04, 2010 Apr 04, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 04, 2010 Apr 04, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 04, 2010 Apr 04, 2010
LATEST

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

Sorry, I still don't understand. Maybe you could explain what you are trying to do in a little more detail. Why does the number of images per project prevent you from using a single recordset and repeating region?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines