Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Central Ohio
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    If Then Else contained in Loop

    Ok, I'm sure there some elementary mistake I'm making in my logic here, but here's my code:

    Code:
    <%
    while not infoRS.eof
    	IF State = infoRS.fields("state") THEN
    	response.write "<tr><td>&nbsp;</td><td>" & infoRS.fields("city") & "</td></tr>" 
    	ELSE
    	Set State = infoRS.fields("state")
    	response.write "<tr><td>" & infoRS.fields("state") &"</td><td>" & infoRS.fields("city") & "</td></tr>" 
    	END IF
    infoRS.movenext	
    wend
    %>
    And instead of getting a nicely laid out table where I have one state, multiple cities, and then another state listed, with more cities...

    I have one state listed at the top left, and every city listed. No more states. Here's the page: http://www.mickeysguidingstuff.net/p...es/content.asp

    Far warning, it cycles thru about 319 records. So it'll take a second or two to process. At least, it has with me. I've trimmed some code out of my example here. Namely, an entire column. But you get the idea of what I'm wanting it to, I hope.

    Is it something simple? Got things in the wrong order or something? It seems like it should work from here. The logic of it, anyway. But it's not doing what I want.

    Any ideas?

    Jer!
    Jers-Web, Inc.
    Ever seen 49,825 Alert Boxes on one page? I have!

  • #2
    New Coder
    Join Date
    Jun 2002
    Location
    Central Ohio
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Great!

    Thanks a bunch! :-)

    Jer!
    Jers-Web, Inc.
    Ever seen 49,825 Alert Boxes on one page? I have!


  •  

    Posting Permissions

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