Forum Moderators: coopster

Message Too Old, No Replies

Repeating Regions

Using two recordsets for two repeats...

         

inveni0

4:53 pm on Feb 1, 2006 (gmt 0)

10+ Year Member



I have a table and I need to do have two repeated regions for it. I can only do one! And when I create two recordsets from the table, there's an error, and the browser loads only a blank screen. Is there a way to repeat two seperate recordsets if they pull from the same table?

coopster

5:20 pm on Feb 1, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Are you asking if you can roll through a single result set twice?

inveni0

5:28 pm on Feb 1, 2006 (gmt 0)

10+ Year Member



No.

One repeat set repeats the data in tables, so that it is easily viewable. There are dozens of tables, though, and scrolling to find the one I want takes a bit.

So, I want a "menu" at the top that lists the primary keys of each of these rows. I've made these into hyperlinks that will jump to the table based on an anchor I have set there (which is also dynamic).

So, basically I need one repeat for the menu, and one repeat for the tables, but they each come from the same table....

coopster

6:57 pm on Feb 1, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



While you are looping, build both lists at the same time. Then, later during the output, print them both out. pseudocode:
<?php 
$topList = ''; // initialize
$html = ''; // initialize
while (retrieving data) {
if (this is a new drop-down item for the top list) {
$topList .= "<option>{$row['myColumn']}</option>";
}
$html .= "<tr><td>{$row['thisTableData']}</td</tr>";
}
?>
<html><head><title>Title</title></head><body>
<?php
print $topList;
print $html;
?>
</body>
</html>