Nested Loop/Repeat Region, PHP

Hello,
My conundrum is trying to gather information from 4 different record sets and do some separate nested loops
There is one record per project
There is one client per project
There may be more than one staff member per project
There may be more that one consultant per project
The MySQL schema is as follows. ( Sorry but there are 7 of them)
mysql> describe ND_assign_consultant;
+---------------+------------------+------+-----+---------+----------------+
| Field         | Type             | Null | Key | Default | Extra          |
+---------------+------------------+------+-----+---------+----------------+
| assign_pro_id | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| project_id    | varchar(8)       | NO   |     |         |                |
| architect_id  | varchar(11)      | NO   |     |         |                |
+---------------+------------------+------+-----+---------+----------------+
mysql> describe ND_assign_project;
+---------------+------------------+------+-----+---------+-------+
| Field         | Type             | Null | Key | Default | Extra |
+---------------+------------------+------+-----+---------+-------+
| assign_pro_id | int(10) unsigned | NO   |     | 0       |       |
| client_id     | varchar(11)      | YES  |     | NULL    |       |
| project_id    | varchar(11)      | YES  |     | NULL    |       |
+---------------+------------------+------+-----+---------+-------+
mysql> describe ND_assign_staff;
+--------------+------------------+------+-----+---------+----------------+
| Field        | Type             | Null | Key | Default | Extra          |
+--------------+------------------+------+-----+---------+----------------+
| assign_id    | int(11) unsigned | NO   | PRI | NULL    | auto_increment |
| project_id   | char(8)          | NO   |     |         |                |
| staff_id     | char(4)          | NO   |     |         |                |
| stake_holder | char(1)          | YES  |     | 0       |                |
+--------------+------------------+------+-----+---------+----------------+
mysql> describe ND_client;
+--------------+---------------------------+------+-----+---------+----------------+
| Field        | Type                      | Null | Key | Default | Extra          |
+--------------+---------------------------+------+-----+---------+----------------+
| client_id    | int(10) unsigned zerofill | NO   | PRI | NULL    | auto_increment |
| title        | varchar(20)               | YES  |     | NULL    |                |
| first_Cname  | varchar(30)               | NO   |     |         |                |
| last_Cname   | varchar(30)               | NO   |     |         |                |
| company      | varchar(80)               | YES  |     | NULL    |                |
| phone        | varchar(12)               | YES  |     | NULL    |                |
| mobile       | varchar(12)               | YES  |     | NULL    |                |
| fax          | varchar(12)               | YES  |     | NULL    |                |
| email        | varchar(80)               | YES  |     | NULL    |                |
| road_type    | varchar(20)               | YES  |     | NULL    |                |
| street       | varchar(100)              | YES  |     | NULL    |                |
| city         | varchar(80)               | YES  |     | NULL    |                |
| State        | char(3)                   | YES  |     | NULL    |                |
| postcode     | varchar(4)                | YES  |     | NULL    |                |
| int_city     | varchar(80)               | YES  |     | NULL    |                |
| int_state    | varchar(80)               | YES  |     | NULL    |                |
| int_postcode | varchar(5)                | YES  |     | NULL    |                |
| country      | varchar(40)               | YES  |     | NULL    |                |
| comments     | text                      | YES  |     | NULL    |                |
+--------------+---------------------------+------+-----+---------+----------------+
mysql> describe ND_consultant;
+-----------------+------------------+------+-----+---------+----------------+
| Field           | Type             | Null | Key | Default | Extra          |
+-----------------+------------------+------+-----+---------+----------------+
| architect_id    | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| consultant_type | varchar(40)      | NO   |     |         |                |
| first_name      | varchar(30)      | YES  |     | NULL    |                |
| last_name       | varchar(30)      | YES  |     | NULL    |                |
| company         | varchar(80)      | YES  |     | NULL    |                |
| licence         | varchar(20)      | YES  |     | NULL    |                |
| phone           | varchar(12)      | YES  |     | NULL    |                |
| mobile          | varchar(12)      | YES  |     | NULL    |                |
| fax             | varchar(12)      | YES  |     | NULL    |                |
| email           | varchar(80)      | YES  |     | NULL    |                |
| website         | varchar(150)     | YES  |     | NULL    |                |
| street          | varchar(100)     | YES  |     | NULL    |                |
| city            | varchar(80)      | YES  |     | NULL    |                |
| state           | char(3)          | YES  |     | NULL    |                |
| postcode        | varchar(4)       | YES  |     | NULL    |                |
| region          | varchar(40)      | YES  |     | NULL    |                |
| regular         | char(1)          | YES  |     | NULL    |                |
+-----------------+------------------+------+-----+---------+----------------+
17 rows in set (0.00 sec)
mysql> describe ND_project;
+----------------+-----------------+------+-----+-------------------+--------------------- --------+
| Field          | Type            | Null | Key | Default           | Extra                       |
+----------------+-----------------+------+-----+-------------------+--------------------- --------+
| project_id     | int(6) unsigned | NO   | PRI | NULL              | auto_increment              |
| listed         | timestamp       | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| deadline       | varchar(25)     | YES  |     | NULL              |                             |
| contact        | varchar(30)     | YES  |     | NULL              |                             |
| project_type   | varchar(20)     | YES  |     | NULL              |                             |
| quote          | decimal(10,0)   | YES  |     | NULL              |                             |
| invoice        | char(3)         | YES  |     | NULL              |                             |
| invoice_number | varchar(8)      | YES  |     | NULL              |                             |
| details        | text            | YES  |     | NULL              |                             |
| status         | varchar(20)     | YES  |     | NULL              |                             |
| streetN        | varchar(20)     | YES  |     | NULL              |                             |
| pro_street     | varchar(100)    | YES  |     | NULL              |                             |
| pro_city       | varchar(80)     | YES  |     | NULL              |                             |
| pro_state      | char(3)         | YES  |     | NULL              |                             |
| pro_postcode   | varchar(4)      | YES  |     | NULL              |                             |
+----------------+-----------------+------+-----+-------------------+--------------------- --------+
mysql> describe ND_staff;
+-------------+----------------------+------+-----+---------+----------------+
| Field       | Type                 | Null | Key | Default | Extra          |
+-------------+----------------------+------+-----+---------+----------------+
| staff_id    | smallint(5) unsigned | NO   | PRI | NULL    | auto_increment |
| f_name      | varchar(30)          | NO   |     |         |                |
| l_name      | varchar(30)          | NO   |     |         |                |
| email       | varchar(80)          | NO   |     |         |                |
| mobile      | varchar(12)          | NO   |     |         |                |
| extension   | char(3)              | NO   |     |         |                |
| username    | varchar(20)          | NO   | UNI |         |                |
| password    | varchar(16)          | NO   |     |         |                |
| rate        | int(3) unsigned      | NO   |     | 0       |                |
| staff1      | char(1)              | YES  |     | NULL    |                |
| staff2      | char(1)              | YES  |     | NULL    |                |
| projects1   | char(1)              | YES  |     | NULL    |                |
| projects2   | char(1)              | YES  |     | NULL    |                |
| clients     | char(1)              | YES  |     | NULL    |                |
| revisions1  | char(1)              | YES  |     | NULL    |                |
| revisions2  | char(1)              | YES  |     | NULL    |                |
| consultants | char(1)              | YES  |     | NULL    |                |
| access      | char(1)              | YES  |     | NULL    |                |
+-------------+----------------------+------+-----+---------+----------------+
I tried to attach the php file and the CSS but they're not allowed.
Record Sets:
<?php
mysql_select_db($database_neilly_davies, $neilly_davies);
$query_qProject = "SELECT project_id, listed, quote, status, streetN, pro_street, pro_city FROM ND_project WHERE status ='In Progress' OR 'Quote'";
$qProject = mysql_query($query_qProject, $neilly_davies) or die(mysql_error());
$row_qProject = mysql_fetch_assoc($qProject);
$totalRows_qProject = mysql_num_rows($qProject);
mysql_select_db($database_neilly_davies, $neilly_davies);
$query_qClient = "SELECT ND_client.client_id, ND_client.first_Cname, ND_client.last_Cname, ND_client.company, ND_assign_project.client_id, ND_assign_project.project_id FROM ND_client, ND_assign_project, ND_project WHERE ND_project.project_id = ND_assign_project.project_id AND ND_client.client_id = ND_assign_project.client_id";
$qClient = mysql_query($query_qClient, $neilly_davies) or die(mysql_error());
$row_qClient = mysql_fetch_assoc($qClient);
$totalRows_qClient = mysql_num_rows($qClient);
mysql_select_db($database_neilly_davies, $neilly_davies);
$query_qStaff = "SELECT ND_staff.staff_id, ND_staff.f_name, ND_staff.l_name, ND_assign_staff.staff_id, ND_assign_staff.project_id, ND_assign_staff.stake_holder, ND_project.project_id FROM ND_staff, ND_assign_staff, ND_project WHERE ND_staff.staff_id = ND_assign_staff.staff_id AND ND_assign_staff.project_id = ND_project.project_id";
$qStaff = mysql_query($query_qStaff, $neilly_davies) or die(mysql_error());
$row_qStaff = mysql_fetch_assoc($qStaff);
$totalRows_qStaff = mysql_num_rows($qStaff);
mysql_select_db($database_neilly_davies, $neilly_davies);
$query_qConsultant = "SELECT ND_consultant.architect_id, ND_consultant.first_name, ND_consultant.last_name, ND_consultant.company, ND_assign_consultant.architect_id, ND_assign_consultant.project_id FROM ND_consultant, ND_assign_consultant WHERE ND_consultant.architect_id = ND_assign_consultant.architect_id";
$qConsultant = mysql_query($query_qConsultant, $neilly_davies) or die(mysql_error());
$row_qConsultant = mysql_fetch_assoc($qConsultant);
$totalRows_qConsultant = mysql_num_rows($qConsultant);
?>
Table requiring the nested loops:
      <tr valign="top">
        <th width="90" align="left"><?php echo $row_qProject['project_id']; ?> </th>
        <td width="90" align="left"><?php echo $row_qProject['status']; ?></td>
        <td align="left"><?php echo $row_qProject['pro_street']; ?> <?php echo $row_qProject['streetN']; ?> <?php echo $row_qProject['pro_city']; ?></td>
        <td align="left"><?php echo $row_qClient['first_Cname']; ?> <?php echo $row_qClient['first_Cname']; ?><br />
            <?php echo $row_qClient['company']; ?></td>
        <td align="left"><?php echo $row_qProject['listed']; ?></td>
        <td width="6">$</td>
        <td align="right"><?php echo $row_qProject['quote']; ?></td>
        <td align="left"><?php echo $row_qStaff['f_name']; ?> <?php echo $row_qStaff['l_name']; ?></td>
        <td align="left"><?php echo $row_qStaff['stake_holder']; ?> </td>
        <td align="left"><?php echo $row_qConsultant['first_name']; ?> <?php echo $row_qConsultant['last_name']; ?><br />
            <?php echo $row_qConsultant['company']; ?> </td>
      </tr>
<tr>
Thanks in advance if you can point me in the right direction.
Steve

Tom Muck has a free Dreamweaver extension that does this: http://www.tom-muck.com/extensions/help/HorizontalLooper/. There's also a reasonably priced commercial version that does more. The link to the commercial version is at the bottom of the page on Tom's site.

Similar Messages

  • Use rsRecordset_total in a repeat region?

    Hi,
    Two recordsets. Recordset A contains customer details,
    including their
    unique customerID.
    I have this in a repeat region, listing customers by order of
    date.
    Recordset B, on the same page, contains order details with a
    PK called
    orderID and a FK; customerID.
    Is it possible to display the <%=(rsRecordsetB_total)%>
    WITHIN the repeat
    region for Recordset A so that, when viewing the list of
    customers, we can
    see how many orders each customer has made?
    So far, it only displays the total for the first recordset
    for every
    customer and we've worked out that this is because we are
    only repeating
    Recordset A, not B, so, therefore, the total for Recordset B
    won't change.
    Hope someone can help,
    Regards
    nath.

    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.

  • Spry widget / php recordsets / repeatable regions

    okay this deals with the spry collapsiblepanel widget in cs3.
    I'm testing the ability to create a news feed with this feature
    paired with a php recordset. My issue involves the repeated widgets
    not working like the first one. I know it probably is a result of
    the region thats being repeated / the collapsible panel. Look at
    the code and this test site that i've worked up.
    test website the
    code is below...i've commented out the start and end of the
    repeated region.

    PHP, being a serverside code, will refresh the page each time there is a request made to the server. JavaScript (and Spry), being a client side code, does not have to send requests to the server and therefore allows you to change the data without a page refresh.
    Having said that, you need to have a Spry dataset in your Accordion panel.
    By following these steps, you will be well on your way to achieving what you want.
    Retrieve your data using PHP and place it in an HTML-table or similar outside of the Accordion panel
    Create a SpryHTMLDataSet based on the HTML-table
    Use the data from the Spry dataset to create a master/detail region in your Accordion panel
    Just a few questions before I go into details.
    Have you set up a connection to a database, thus be able to retrieve the data?
    Why do you need an Accordion panel to show your data?
    Have you got an online URL so that we can follow your code? Otherwise please include your code in your post.
    Please come back here with your answers and we shall try to help you on your way
    Ben

  • Nested repeat Region - run time var PHP

    I have tried several attempts at creating a nested region
    with no luck of sucess
    sql & PHP
    There are 2 record sets
    rsProduct and
    rsCourse
    rsProduct
    SELECT *
    FROM svProductList
    WHERE svProductList.productOrder
    ORDER BY productOrder ASC
    rsCourse
    SELECT *
    FROM trainingCourseTBL
    WHERE trainingCourseTBL.product = colname
    ORDER BY trainingCourseTBL.courseOrder ASC
    colname
    type numeric
    default value -1
    runtim value $row_rsProduct['productOrder']
    Start repeat region 1
    rsProduct.productName
    Start repeat region 2
    rsCourse.course
    END repeat region 2
    END Start repeat region 1
    I would like to set up a run time var for the rsCourse where
    I get the value from the first repeat regions productID
    Can someone point me towards the right direction?

    On 21 May 2007 in macromedia.dreamweaver.appdev, cdembek
    wrote:
    > Can someone point me towards the right direction?
    I don't have time for a long explanation right now, but do a
    web search
    for 'Nested Repeat Region'.
    Joe Makowiec
    http://makowiec.net/
    Email:
    http://makowiec.net/contact.php

  • PHP help with nested repeat region

    Hopefully someone can help me out with this one.
    I basically have some SQL returning results of a search page,
    where you can search on various keywords by checking boxes, and it
    returns Employers that match those keywords :
    mysql_select_db($database_myDatabase, $myDatabase);
    if (isset($_GET['ckbox'])){
    // get profile keys
    $ckbox = array_keys($_GET['ckbox']);
    // sql string
    $sql = 'SELECT Employers.*, EmployerContacts.* FROM
    EmployerContacts
    INNER JOIN Employers ON EmployerContacts.EmployerID =
    Employers.EmployerID
    INNER JOIN EmployerProfiles ON EmployerProfiles.EmployerID =
    EmployerContacts.EmployerID
    WHERE EmployerProfiles.ProfileID IN(' . implode(',',
    $ckbox).')
    GROUP BY Employers.EmployerID
    ORDER BY Employers.EmployerID DESC';
    $rsContacts = mysql_query($sql) or die(mysql_error());
    $row_rsContacts = mysql_fetch_assoc($rsContacts);
    @$totalRows = mysql_num_rows($rsContacts);
    else
    echo 'You did not check any profiles.';
    ?>
    The results are drawing fields from the Employers table and
    EmployerContacts table, hopefully to look like :
    Employer1
    Employer1.Contact 1
    Employer1.Contact 2
    Employer1.Contact 3
    Employer2
    Employer2.Contact 1
    Employer2.Contact 2
    Employer2.Contact 3
    etc
    However, I can only seem to get it to repeat the Employers,
    and show just the first Contact for each, like this :
    Employer1
    Employer1.Contact 1
    Employer2
    Employer2.Contact 1
    etc
    So I guess I'm looking for help with looping through the
    Contacts for each Employer.
    The code currently looks like this :
    [code attached]
    Hope that makes sense.
    Many thanks.

    Iain71,
    The DW Repeat Region cannot be nested because both loops use
    the same
    variable names (e.g. $RepeatSelectionCounter_1).
    You will have to manually edit the code, and DW may not
    recognize it
    after you do, but you should be able to get it working fairly
    easily. I
    think that you just need to change the variable names in the
    inner loop
    so that they do not conflict with the similar names in the
    outer loop
    (e.g. rename $RepeatSelectionCounter_1 to
    $RepeatSelectionCounter_2).
    Does that make sense?
    HTH,
    Randy
    > I basically have some SQL returning results of a search
    page, where you can
    > search on various keywords by checking boxes, and it
    returns Employers that
    > match those keywords :

  • Nested Repeat Region (How to convert from table to list)

    Sorry, i am really no PHP hero :-(
    i created a menu with the "nested repeat region" wizzard. Now i want to change the HTML from TABLE to LIST.
    I thought i just need to delete <table>- and <td>-tags, replace <tr> with <ul> and that's it. (But ist's NOT!)
    This is my code:
    ------- START ----------------
    <ul id="nav">
          <?php do { ?>      
              <li><?php echo $row_master1waa_page_top['top_name']; ?></li>
            <?php
      if ($totalRows_master1waa_page_top>0) {
        $nested_query_detail2waa_page_sub = str_replace("123456789", $row_master1waa_page_top['id_top'], $query_detail2waa_page_sub);
        mysql_select_db($database_WAA);
        $detail2waa_page_sub = mysql_query($nested_query_detail2waa_page_sub, $WAA) or die(mysql_error());
        $row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub);
        $totalRows_detail2waa_page_sub = mysql_num_rows($detail2waa_page_sub);
        $nested_sw = false;
        if (isset($row_detail2waa_page_sub) && is_array($row_detail2waa_page_sub)) {
          do { //Nested repeat
    ?>
              <ul>
                <li>  <?php echo $row_detail2waa_page_sub['sub_head']; ?></li>
              </ul>
              <?php
          } while ($row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub)); //Nested move next
    ?>
            <?php } while ($row_master1waa_page_top = mysql_fetch_assoc($master1waa_page_top)); ?>
    </ul>  
    ------- END -----
    The problem is located in line 3. the result is a list like this:
    <ul id="nav">
         <li>xxx</li>
         <li>xxx</li>
              <ul>
                    <li>xxx</li>
                    <li>xxx</li>
              </ul>
         <li>xxx</li>
    </ul>
    Of course it will not work. I need the nested list inserted like this:
    <ul id="nav">
         <li>xxx</li>
         <li>xxx
              <ul>
                    <li>xxx</li>
                    <li>xxx</li>
              </ul>
          </li>
         <li>xxx</li>
    </ul>
    Can someone please help me changing my code to get this result?

    Hi,
    I had trouble replying. I may be of some assistance until one of the Guru's get on.
    The whole thing works on loops based inside do and while
    EX.
    <?php
              do{    //end php, use html
    ?>
    I can repeat anthing here in HTML!
    <?php } while ( /* some critera exist ex: i<5 */      ); ?>
    so, your 'options' tag or LI' tags should only exist inside the first loop, check your { }
    The entire LIST  would repeat if you add the UL tags inside the nested loop area
    You may find it easier to reaplace the table with div tags and then indent the sub or nested loop with a class
    I don't have time to test this but try this:
    <ul id="nav">
    <ul>
    <?php do { ?>      
      <li><?php echo $row_master1waa_page_top['top_name']; ?></li>
    <?php
      if ($totalRows_master1waa_page_top>0) {
        $nested_query_detail2waa_page_sub = str_replace("123456789", $row_master1waa_page_top['id_top'], $query_detail2waa_page_sub);
        mysql_select_db($database_WAA);
        $detail2waa_page_sub = mysql_query($nested_query_detail2waa_page_sub, $WAA) or die(mysql_error());
        $row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub);
        $totalRows_detail2waa_page_sub = mysql_num_rows($detail2waa_page_sub);
        $nested_sw = false;
        if (isset($row_detail2waa_page_sub) && is_array($row_detail2waa_page_sub)) { ?>
       <ul>
      <?php  do { //Nested repeat ?>   
                   <li>  <?php echo $row_detail2waa_page_sub['sub_head']; ?></li>
            <?php } while ($row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub)); //Nested move next ?>
        </ul>
    <?php 
    ?>
            <?php } while ($row_master1waa_page_top = mysql_fetch_assoc($master1waa_page_top)); ?>
    </ul>
    Hit me back if its close but wonky..
    J

  • How can I use a Looper inside a Repeat Region?

    I have a Dreamweaver standard Repeat Region applied to a HTML table containing two horizontal loopers. The HTML table is to display a list of company contacts for our members. The loopers display find for the first company but after that they stop. To key the loopers to the company Im using a trick mentioned by Günter Schenk in this thread: http://www.adobeforums.com/webx/.59b524b4/5. He calls it a sub query; at times I use to help myself by using some sort of "sub query" like the following
    <br />
    <br />Ive linked my looper recordset to the recordset used for the Repeat Region. Heres one of the looper queries:
    <br />
    <br />$KTColParam1_rsContactFeatures = "-1";
    <br />if (isset($_SESSION["kt_login_id"])) {
    <br />$KTColParam1_rsContactFeatures = $_SESSION["kt_login_id"];
    <br />}
    <br />mysql_select_db($database_RNW, $RNW);
    <br />$query_rsContactFeatures = sprintf("SELECT DISTINCT list_feature.description_feature, company.id_company, contact_cnt.idpremissions_cnt FROM (((company LEFT JOIN company_to_feature ON company_to_feature.idcompany=company.id_company) RIGHT JOIN list_feature ON list_feature.id_list_feature=company_to_feature.idlistfeature) LEFT JOIN contact_cnt ON contact_cnt.idcompany_cnt=company.id_company) WHERE company.id_company='".$row_rsContactAll['id_company']."' AND company_to_feature.id_feature is not null AND contact_cnt.idpremissions_cnt=%s ORDER BY company.id_company ASC ", GetSQLValueString($KTColParam1_rsContactFeatures, "int"));
    <br />$rsContactFeatures = mysql_query($query_rsContactFeatures, $RNW) or die(mysql_error());
    <br />$row_rsContactFeatures = mysql_fetch_assoc($rsContactFeatures);
    <br />$totalRows_rsContactFeatures = mysql_num_rows($rsContactFeatures);
    <br />
    <br />This is my link in both quires: WHERE company.id_company='".$row_rsContactAll['id_company']."'
    <br />
    <br />Heres the code for the connected looper:
    <br />
    <br /><?php<br />do { // horizontal looper version 3<br />?>
    <br />
    <br />
    <br />
    <br />
    <br />As I said this works fine for the first item in the list but then it quits. Heres a screen shot of what I dont want: http://www.retirenw.com/images/help/looper_inside_repeat_region.gif
    <br />
    <br />Is there anyway to change the php for the loopers to make this work?
    <br />
    <br />Thanks for your help
    <table>
    <tr>
    <td>
    <img src="../images/bullet.gif" width="8" height="14" />
    </td>
    <td>
    <?php echo $row_rsContactFeatures['description_feature']; ?>
    </td><?php <br />$row_rsContactFeatures = mysql_fetch_assoc($rsContactFeatures);<br />if (!isset($nested_rsContactFeatures)) { <br />$nested_rsContactFeatures= 1;<br />}<br />if (isset($row_rsContactFeatures) && is_array($row_rsContactFeatures) && $nested_rsContactFeatures++ % 1==0) {<br />echo "</tr><tr>";<br />}<br />} while ($row_rsContactFeatures); //end horizontal looper version 3<br />?>
    </tr>
    </table>

    I found an easy solution.
    I moved my looper quires out of my head and into my bodyinside the repeat region (the Looper Wizard puts the quires in the head). I put the quires right before my looper code. Finally, I had to make sure my conditional regional code came after the looper quires but before the looper code.

  • Nested Repeat Regions in Dreamweaver 8

    I am waying the option of upgrading from MX to 8 or just
    getting MX Looper to do nested repeat regions. Any advice? Are
    nested repeat regions built into Dreamweaver 8?

    SmellyPete wrote:
    > I've got a problem with nested templates in my site. I
    don't think it's an
    > error or bug as such, just a really strange limitation,
    that I hope there is a
    > work around for.
    >
    > I've setup a menubar with a repeating table region in a
    template. Then I laid
    > out the content (editable) regions in a nested template.
    The system works
    > really well in dreamweaver, if you want to add a menu
    item, you do so to the
    > parent template, and then it filters through out the
    site.
    >
    > The problem is that when I try to edit the pages as a
    client with contribute
    > (even as an administrator) it will not allow access to
    edit a .dwt file, even
    > if it has editable regions in it. This means I can't use
    contribute to add an
    > item to the menubar, because I need to be able to edit
    the nested template. I'm
    > sure it's possible, because a .dwt is just an .htm file
    with a different hat on.
    >
    > There must be some way of doing this. As soon as I read
    about the template
    > system I immediately thought this would be one of it's
    strengths, and would be
    > very surprised if the contribute user were limited to
    making changes on every
    > individual page.
    >
    > PS. I'm sure someone will suggest that I just move the
    repeating region into
    > the nested template. I could do this, but the whole
    point is that with one
    > change I want it to will filter down through the whole
    site. I thought maybe
    > SSI might be the answer, but would that just confuse
    contribute even more?
    >
    It seems to me the whole point of using Contribute is to keep
    users from
    changing basic site configurations such as the menu. Use
    Dreamweaver or
    one of the simple HTML editors around.

  • Nested Repeat Region

    Dreamweaver CS3
    ASP / VBScript
    Hi,
    I'm trying to create a nested repeat region to display a list
    of categories
    and, in brackets afterwards, a count of the number of
    sub-categories
    contained in it E.g.
    Cats (12)
    Dogs (43)
    Fish (92)
    Etc
    I have managed to create my repeat region ok because as soon
    as I drop a
    field in from the recordset, it loops through them all and
    displays them
    correctly. However, when I try and simply write out the total
    number of
    records found, it doesn't display anything.
    Recordset 1 is a straighforward select from the table.
    Recordset 2 adds a
    WHERE clause usinga variable based on the 1st recordset. Here
    is the code
    i'm using for the 2 recordsets:
    Recordset 1 :
    <%
    Dim Level1
    Dim Level1_cmd
    Dim Level1_numRows
    Set Level1_cmd = Server.CreateObject ("ADODB.Command")
    Level1_cmd.ActiveConnection = MM_SemiDirectory_STRING
    Level1_cmd.CommandText = "SELECT * FROM TBL_Level1 ORDER BY
    [Description]
    ASC"
    Level1_cmd.Prepared = true
    Set Level1 = Level1_cmd.Execute
    Level1_numRows = 0
    %>
    Recordset 2 :
    <%
    Dim Level2__varLink
    Level2__varLink = "1"
    If (level1.fields.item("Level1_ID").value <> "") Then
    Level2__varLink = level1.fields.item("Level1_ID").value
    End If
    %>
    <%
    Dim Level2
    Dim Level2_cmd
    Dim Level2_numRows
    Set Level2_cmd = Server.CreateObject ("ADODB.Command")
    Level2_cmd.ActiveConnection = MM_SemiDirectory_STRING
    Level2_cmd.CommandText = "SELECT * FROM TBL_Level2 WHERE
    Level1_ID = ? ORDER
    BY Level1_ID ASC"
    Level2_cmd.Prepared = true
    Level2_cmd.Parameters.Append
    Level2_cmd.CreateParameter("param1", 5, 1, -1,
    Level2__varLink) ' adDouble
    Set Level2 = Level2_cmd.Execute
    Level2_numRows = 0
    %>
    Now for the repeated code :
    <%
    While ((Repeat1__numRows <> 0) AND (NOT Level1.EOF))
    %>
    <li><a
    href="category.asp?level1=<%=(Level1.Fields.Item("Level1_ID").Value)%>"><%=(Level1.Fields .Item("Description").Value)%>
    (<%=(Level2_total)%>)
    </li></a>
    <%
    Repeat1__index=Repeat1__index+1
    Repeat1__numRows=Repeat1__numRows-1
    Level1.MoveNext()
    Wend
    %>
    Can anyone tell me what I need to do to this code to make it
    display the
    number of sub-categories?
    Thanks!!!

    Ok folks,
    I found a way to get what I want. It's not pretty as I had to
    make an extra
    query in the database (that select of the count of all child
    table results
    for each parent category) and am pulling from that but it
    works and that's
    the main thing. I'm sure there is a more effective way of
    doing it but
    that's life!
    I'm still interested in knowing the 'proper' way (if there is
    such a thing)
    so if you have the time to show me, i'm all ears!
    Cheers!
    "Mintyman" <[email protected]> wrote in message
    news:[email protected]...
    > Ok,
    >
    > So I closed the <li> code before the <a>
    code. D'oh!
    >
    > Anyway, it returns a number now........the problem now
    is that it returns
    > the same value for each parent repeat!!!
    >
    > "Mintyman" <[email protected]> wrote in message
    > news:[email protected]...
    >> Dreamweaver CS3
    >> ASP / VBScript
    >>
    >> Hi,
    >>
    >> I'm trying to create a nested repeat region to
    display a list of
    >> categories and, in brackets afterwards, a count of
    the number of
    >> sub-categories contained in it E.g.
    >>
    >> Cats (12)
    >> Dogs (43)
    >> Fish (92)
    >> Etc
    >>
    >> I have managed to create my repeat region ok because
    as soon as I drop a
    >> field in from the recordset, it loops through them
    all and displays them
    >> correctly. However, when I try and simply write out
    the total number of
    >> records found, it doesn't display anything.
    >>
    >> Recordset 1 is a straighforward select from the
    table. Recordset 2 adds a
    >> WHERE clause usinga variable based on the 1st
    recordset. Here is the
    >> code i'm using for the 2 recordsets:
    >>
    >> Recordset 1 :
    >>
    >> <%
    >> Dim Level1
    >> Dim Level1_cmd
    >> Dim Level1_numRows
    >>
    >> Set Level1_cmd = Server.CreateObject
    ("ADODB.Command")
    >> Level1_cmd.ActiveConnection =
    MM_SemiDirectory_STRING
    >> Level1_cmd.CommandText = "SELECT * FROM TBL_Level1
    ORDER BY [Description]
    >> ASC"
    >> Level1_cmd.Prepared = true
    >>
    >> Set Level1 = Level1_cmd.Execute
    >> Level1_numRows = 0
    >> %>
    >>
    >> Recordset 2 :
    >>
    >> <%
    >> Dim Level2__varLink
    >> Level2__varLink = "1"
    >> If (level1.fields.item("Level1_ID").value <>
    "") Then
    >> Level2__varLink =
    level1.fields.item("Level1_ID").value
    >> End If
    >> %>
    >> <%
    >> Dim Level2
    >> Dim Level2_cmd
    >> Dim Level2_numRows
    >>
    >> Set Level2_cmd = Server.CreateObject
    ("ADODB.Command")
    >> Level2_cmd.ActiveConnection =
    MM_SemiDirectory_STRING
    >> Level2_cmd.CommandText = "SELECT * FROM TBL_Level2
    WHERE Level1_ID = ?
    >> ORDER BY Level1_ID ASC"
    >> Level2_cmd.Prepared = true
    >> Level2_cmd.Parameters.Append
    Level2_cmd.CreateParameter("param1", 5,
    >> 1, -1, Level2__varLink) ' adDouble
    >>
    >> Set Level2 = Level2_cmd.Execute
    >> Level2_numRows = 0
    >> %>
    >>
    >>
    >> Now for the repeated code :
    >>
    >>
    >> <%
    >> While ((Repeat1__numRows <> 0) AND (NOT
    Level1.EOF))
    >> %>
    >> <li><a
    >>
    href="category.asp?level1=<%=(Level1.Fields.Item("Level1_ID").Value)%>"><%=(Level1.Fields .Item("Description").Value)%>
    >> (<%=(Level2_total)%>)
    >> </li></a>
    >>
    >>
    >> <%
    >> Repeat1__index=Repeat1__index+1
    >> Repeat1__numRows=Repeat1__numRows-1
    >> Level1.MoveNext()
    >> Wend
    >> %>
    >>
    >> Can anyone tell me what I need to do to this code to
    make it display the
    >> number of sub-categories?
    >>
    >> Thanks!!!
    >>
    >>
    >>
    >
    >

  • Nested Repeat Regions

    I've got a page where I need nested repeat regions using the
    same data.
    Basically, list people who have donated money in groupings by
    level:
    $100-$199
    Murray
    Nadia
    Thierry
    $200-$299
    Dan
    Dan
    Patty
    I'm looking at Tom Muck's "Simulated Nested Region" extension
    so I can do
    this using one Recordset (seems silly to set up a recordset
    for each
    donation level) but the only problem is it looks like the
    donation levels
    have to sort in order to work, and they don't.
    Anyone know of any other extensions or easy ways to make this
    work?
    Oh yeah.....MySQL and PHP.
    Thanks!
    Mad Dog

    SmellyPete wrote:
    > I've got a problem with nested templates in my site. I
    don't think it's an
    > error or bug as such, just a really strange limitation,
    that I hope there is a
    > work around for.
    >
    > I've setup a menubar with a repeating table region in a
    template. Then I laid
    > out the content (editable) regions in a nested template.
    The system works
    > really well in dreamweaver, if you want to add a menu
    item, you do so to the
    > parent template, and then it filters through out the
    site.
    >
    > The problem is that when I try to edit the pages as a
    client with contribute
    > (even as an administrator) it will not allow access to
    edit a .dwt file, even
    > if it has editable regions in it. This means I can't use
    contribute to add an
    > item to the menubar, because I need to be able to edit
    the nested template. I'm
    > sure it's possible, because a .dwt is just an .htm file
    with a different hat on.
    >
    > There must be some way of doing this. As soon as I read
    about the template
    > system I immediately thought this would be one of it's
    strengths, and would be
    > very surprised if the contribute user were limited to
    making changes on every
    > individual page.
    >
    > PS. I'm sure someone will suggest that I just move the
    repeating region into
    > the nested template. I could do this, but the whole
    point is that with one
    > change I want it to will filter down through the whole
    site. I thought maybe
    > SSI might be the answer, but would that just confuse
    contribute even more?
    >
    It seems to me the whole point of using Contribute is to keep
    users from
    changing basic site configurations such as the menu. Use
    Dreamweaver or
    one of the simple HTML editors around.

  • Email php function repeat region not working

    i have a form that needs to be emailed and it as products attached to it. however i have a repeat region to list all the products but when i email it ithe email only shows the first item on the list.
    below is the form set up
    //emailer
        // Email new tenant information
            $to = '[email protected]';// . ',' . '$row_rsOrder["Email"]';
            //$to = $row_rsOrder["Email"];
            $subject = "Your Order Details";
            $message = "
    <html>
    <head>
    <title>Dear ".$row_rsOrder['FirstName'].$row_rsOrder['LastName']."  please see your Order Details Below</title>
    </head>
            <body>
            <img src=\"http://www.website.com/images/logoBLPP.jpg\" alt=\"" />
            <h2>Your B Order".$row_rsOrder['OrderID']."</h2>
            <table width='800' border='0' cellspacing='0' cellpadding='0'>
                            <tr><td><p>Thank you for shopping  below are you details of the order you have recently placed. If you have any questions please contact us</p>
      <br />
            </a></p>
                            <tr><td></td></tr></table>
    <table width='980' border='1' cellspacing='0' cellpadding='10'>
          <tr valign='top'>
            <td bgcolor='#E9E9E9' class='header1'>Customer Name</td>
            <td class='text'>".$row_rsOrder['FirstName'] . $row_rsOrder['LastName']."</td>
            <td bgcolor='#E9E9E9' class='header1'>Order ID</td>
            <td bgcolor='#E9E9E9' class='text'>".$row_rsOrder['OrderID']."</td>
            <td bgcolor='#E9E9E9' class='header1'>Order Status</td>
            <td class='text'>".$row_rsOrder['TransactResult']."</td>
          </tr>
          <tr valign='top'>
            <td bgcolor='#E9E9E9' class='header1'>Email</td>
            <td class='text'>".$row_rsOrder['Email']."</td>
            <td bgcolor='#E9E9E9' class='header1'> </td>
            <td class='text'> </td>
            <td bgcolor='#E9E9E9' ><span class='header1'>Order Date</span></td>
            <td class='text'>".makeDateTime($row_rsOrder['OrderDate'], '%#d %B %Y', true)."</td>
          </tr>
          <tr valign='top'>
            <td bgcolor='#E9E9E9' class='header1'>Shipping Address</td>
            <td class='text'><p>".$row_rsOrder['Address']."</p>
              <p>".$row_rsOrder['Town']."</p>
              <p>".$row_rsOrder['PostCode']."</p>
              <p>".$row_rsOrder['Country']."</p>
              <p> </p></td>
            <td> </td>
            <td> </td>
            <td colspan='2' align='right' valign='bottom'><span class='header'> ORDER TOTAL:".DoFormatCurrency($row_rsOrder['Total'], 2, ',', '.', '£ ', '')."<br />
              </span><span class='text'>Shipping:".DoFormatCurrency($row_rsOrder['Shipping'], 2, ',', '.', '£ ', '')."</span><span class='header'><br />
            </span></td>
          </tr>
          <tr valign='top'>
            <td bgcolor='#E9E9E9' class='header1'>Product ID</td>
            <td bgcolor='#E9E9E9' class='header1'>Product Description</td>
            <td bgcolor='#E9E9E9' colspan='2' class='header1'>Size</td>
            <td bgcolor='#E9E9E9' ><span class='header1'>Quantity</span></td>
            <td bgcolor='#E9E9E9' align='right'><span class='header1'>Price</span></td>
          </tr>
          <?php do { ?>
          <tr valign='top'>
            <td class='text'>".$row_rsOrder['ProductID']."</td>
            <td class='text'>".$row_rsOrder['Product'].','.$row_rsOrder['catname']."</td>
            <td colspan='2' class='text'>".$row_rsOrder['UnitSize']."</td>
            <td><span class='text'>".$row_rsOrder['Quantity']."</span></td>
            <td align='right' class='text'>". DoFormatCurrency($row_rsOrder['UnitPrice'], 2, ',', '.', '£ ', '')."</td>
          </tr>
          <?php } while ($row_rsOrder = mysql_fetch_assoc($rsOrder)); ?>
            <tr valign='top'>
            <td class='text'> </td>
            <td class='text'> </td>
            <td colspan='2' class='text'> </td>
            <td> </td>
            <td> </td>
          </tr>
        </table>
    </body>
    </html>
            // Always set content-type when sending HTML email
            $headers = "MIME-Version: 1.0" . "\r\n";
            $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
            $headers .= 'From: company name <[email protected]>' . "\r\n";
            $send = mail($to, $subject, $message, $headers);

    Yes, ALL product information in the database were retrieved and sent to the email. Only 3 products for testing purposes.
    I just tested it down to the do-while loop. The html table code after that is missing.
    You have to bare in mind this is a crude test. The database set up query is not as complex as yours is so that may be why its working but certainly breaking up the 'message' is the way to go. I may try and get the products from another table tomorrow if I have time to test.
    The html code and column database names are the same as you have. the recordeset is 'rsOrders' instead of 'rsOrder' that you used,
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    mysql_select_db($database_conDonations, $conDonations);
    $query_rsOrders = "SELECT * FROM orders";
    $rsOrders = mysql_query($query_rsOrders, $conDonations) or die(mysql_error());
    $row_rsOrders = mysql_fetch_assoc($rsOrders);
    $totalRows_rsOrders = mysql_num_rows($rsOrders);
    //emailer
        // Email new tenant information
    $to = '[email protected]';// . ',' . '$row_rsOrder["Email"]';
            //$to = $row_rsOrder["Email"];
    $subject = "Your Order Details";
    $message = "
    <html>
    <head>
    <title>Dear ".$row_rsOrders['FirstName']." please see your Order Details Below</title>
    </head>
            <body>
    <img src=\"http://www.website.com/images/logoBLPP.jpg\" alt=\"\" />
    <h2>Your B Order".$row_rsOrders['OrderID']."</h2>
    <table width='800' border='0' cellspacing='0' cellpadding='0'>
    <tr><td><p>Thank you for shopping  below are you details of the order you have recently placed. If you have any questions please contact us</p>
    <br />
    </a></p>
    <tr><td></td></tr></table>
    <table width='980' border='1' cellspacing='0' cellpadding='10'>
          <tr valign='top'>
            <td bgcolor='#E9E9E9' class='header1'>Customer Name</td>
            <td class='text'>".$row_rsOrders['FirstName']."</td>
            <td bgcolor='#E9E9E9' class='header1'>Order ID</td>
            <td bgcolor='#E9E9E9' class='text'>".$row_rsOrders['OrderID']."</td>
            <td bgcolor='#E9E9E9' class='header1'>Order Status</td>
            <td class='text'>".$row_rsOrders['TransactResult']."</td>
          </tr>
                             <tr valign='top'>
            <td bgcolor='#E9E9E9' class='header1'>Email</td>
            <td class='text'>".$row_rsOrders['Email']."</td>
            <td bgcolor='#E9E9E9' class='header1'> </td>
            <td class='text'> </td>
            <td bgcolor='#E9E9E9' ><span class='header1'>Order Date</span></td>
            <td class='text'>".$row_rsOrders['OrderDate']."</td>
          </tr>
                            <tr valign='top'>
            <td bgcolor='#E9E9E9' class='header1'>Shipping Address</td>
            <td class='text'><p>".$row_rsOrders['Address']."</p>
              <p>".$row_rsOrders['Town']."</p>
              <p>".$row_rsOrders['PostCode']."</p>
              <p>".$row_rsOrders['Country']."</p>
              <p> </p></td>
            <td> </td>
            <td> </td>
            <td colspan='2' align='right' valign='bottom'><span class='header'> ORDER TOTAL:".$row_rsOrders['Total']."<br />
              </span><span class='text'>Shipping:".$row_rsOrders['Shipping']."</span><span class='header'><br />
            </span></td>
                                      </tr>
          <tr valign='top'>
            <td bgcolor='#E9E9E9' class='header1'>Product ID</td>
            <td bgcolor='#E9E9E9' class='header1'>Product Description</td>
            <td bgcolor='#E9E9E9' colspan='2' class='header1'>Size</td>
            <td bgcolor='#E9E9E9' ><span class='header1'>Quantity</span></td>
            <td bgcolor='#E9E9E9' align='right'><span class='header1'>Price</span></td>
          </tr>";
                            ?>
    <?php do { ?>
    <?php $message .="  <tr valign='top'>
            <td class='text'>".$row_rsOrders['ProductID']."</td>
            <td class='text'>".$row_rsOrders['Product']."</td>
            <td colspan='2' class='text'>".$row_rsOrders['UnitSize']."</td>
            <td><span class='text'>".$row_rsOrders['Quantity']."</span></td>
            <td align='right' class='text'>".$row_rsOrders['UnitPrice']."</td>
          </tr>";
                            ?>
    <?php } while ($row_rsOrders = mysql_fetch_assoc($rsOrders)); ?>
    <?php $message .="
    </body>
    </html>";
            // Always set content-type when sending HTML email
            $headers = "MIME-Version: 1.0" . "\r\n";
            $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
            $headers .= 'From: company name <[email protected]>' . "\r\n";
            $send = mail($to, $subject, $message, $headers);
    mysql_free_result($rsOrders);
    ?>

  • Nested templates - problems with inheriting editable/repeating regions

    I have made a template called 'basic', with 2 sections, 'maincontent' and 'sidecontent' then nested a template in it called 'home'. In 'home', I have made repeats of some regions (sidecontent) and edited them to make a section I want on all 'home' type pages. When I make  a new document from 'basic', it has all the same editable and repeating regions as 'basic'. But when I make a new document from 'home' there are no editable or repeating regions, either in 'sidecontent' which I edited or 'maincontent' which I didn't. I want to be able to edit 'maincontent' when I make a new document from 'home', to make repeating regions and edit them. Please can you advise me what to do?
    Thanks

    When I tried to attach the files it automatically zipped them again, so I have put the code above.
    Thanks,
    Rachel

  • PhP/MySQL Horizontal/Vertical Repeat Region

    Hi Guys,
    I'm pretty sure this question would have been asked many times before. If so, first of all my apologies for re-posting this.
    Anyway, what I'm trying to do is create a repeat region that spans for 4 columns and then repeats the rest in rows. For example, if I have 100 records in my table (MySQL), then I want to display this in a table of 4 columns and and 25 rows (in reality, the number of records would be unspecified, of course, but still the records need to be displayed on a 4 column, X row table). For example:
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    name
    comment
    At the moment, I have no issue with displaying the records either horizontally or vertically (explicitly) using the built in "repeat region" behavior. However, where I'm having the problem is with displaying the records in a table as the one I described above.
    I'm using DW CS5 with PhP/MySQL.
    Can I still do this using the built in "repeat region" server behavior, if so how?
    Otherwise, how else could I achieve this (ideally without using any extensions)?
    Thanks in advance for any help and support,
    Cheers

    I'm believe you should be able to modify the repeat region code to do what you want it to do.  With that said we will need 2 things:
    1.  To see the code from the page.
    2.  To know the order of the results is it:
    Horizontal: 1 2 3 4
                    5 6 7 8
    Or Vertical:
    1 5
    2 6
    3 7
    4 8

  • Php/MySQL Repeated region which doen't include the last item?

    Hi,
    I hope somebody can help me with this. I use php/MySQL.
    I need t create a repeated region which doen't include the last item (post) added to the table.
    Does somebody know how to establish this?

    In SQL, there is no native concept of the last item inserted. It's up to you to control that. What is your definition of the last item? Is it the row with the greatest datetime stamp? An autoincrement id field? Something else?
    Using an autoincrement id field as an example, the last row inserted will have the largest value, so
    Select * from MyTable where MyID != (select max MyID from MyTable)

  • Limit records in nested repeat region

    I am using the nested repeat region behaviour and I need to limit the amount of records in the detail table.
    in ADDT it guides you through a wizard for master and detail tables to use this nesting which works great but it also returns all the records in the detail. I would like to limit the amount.
    I tried modifying the query by adding
    $maxRows_detail4tbl_products = 4;
    $pageNum_detail4tbl_products = 0;
    if (isset($_GET['pageNum_detail4tbl_products'])) {
      $pageNum_detail4tbl_products = $_GET['pageNum_detail4tbl_products'];
    $startRow_detail4tbl_products = $pageNum_detail4tbl_products * $maxRows_detail4tbl_products;
    still returns all rows. any help is greatly appreciated.

    In the Application Panel,  select the tab Biddings
    dbclick  Recordset Detail. Click the Advanced  button, in the last SQL command ORDER BY
    You add LIMIT 0,4

Maybe you are looking for