#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    15
    Rep Power
    0

    Problem with result sets and while loops


    have the following code:
    <%
    cpartner.connect();
    ResultSet rsPartner = cpartner.getPartner();
    ResultSet rsPartnerCategories = cpartner.getPartnerCategories();
    while (rsPartnerCategories.next())
    {
    %>

    <TR><TD colspan="2"><%= rsPartnerCategories.getString("PartnerCategoryName") %></TD></TR>

    <%
    while (rsPartner.next())
    {
    %>

    <TR><TD valign="top"><img src="images/arrow.gif" width="10" height="10" alt=""></TD>
    <TD><%= rsPartnerCategories.getString("PartnerCategoryName") %>|<%= rsPartner.getString("PartnerCategoryName") %>|<%= rsPartner.getString("PartnerName") %></A><BR><BR><P></TD></TR>

    <%
    }
    }
    %>

    I was expecting to have the outer while spit out the results (of which there are three) and within each of those results have the inner while spit out six results.

    Instead I get:
    OuterLoopItem1
    - InnerLoopItem1
    - InnerLoopItem2
    - InnerLoopItem..
    - InnerLoopItem6
    OuterLoopItem2
    OuterLoopItem3

    For the Inner Loop I have to have multiple columns(ID, Name, URL)
    Can anyone help please?
    Last edited by codechimp; May 6th, 2003 at 01:28 PM.

IMN logo majestic logo threadwatch logo seochat tools logo