SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Not show same values if they exist

    Hey,

    If i have this code:

    Code:
                    <select id="AvailableTourCodes" multiple="multiple">
                        <%
                        Do While Not Rec.EOF
                            %>
                            <option value="<%=Rec(0)%>"><%=Rec(1)%></option>
                            <%
                            Rec.MoveNext
                        Loop
                        %>
                    </select>
    Which gives this result:

    <option value="88664">RHMA811</option>
    <option value="88673">MAGA711</option>
    <option value="88674">MAGA711</option>
    <option value="88674">MAGA711</option>
    <option value="88681">MRCAM11</option>
    <option value="88684">NYA5D11</option>
    <option value="88690">GFA1211</option>
    I want to remove the duplicates, now i can't do this via the SQL because of the way it has been setup, it will cause problems elsewhere.

    So what i want to do it try and looop through and remove the duplicates so the result is this:

    <option value="88664">RHMA811</option>
    <option value="88673">MAGA711</option>
    <option value="88681">MRCAM11</option>
    <option value="88684">NYA5D11</option>
    <option value="88690">GFA1211</option>
    Is this possible?

    Kind regards,
    Software Engineer ASP, ASP.NET, VB, PHP

    Kind regards
    Billy

  2. #2
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I figured it out. I declared a variable and set the value or the recordset to that. Then i checked to see if the values matched, if so i didnt display the <option>.

    Software Engineer ASP, ASP.NET, VB, PHP

    Kind regards
    Billy

  3. #3
    SitePoint Addict itHighway's Avatar
    Join Date
    Jan 2008
    Location
    GUJ
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You may also use DISTINCT in your sql query.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •