Web Analytics Made Easy -
StatCounter If Then Else contained in Loop - CodingForum

Announcement

Collapse
No announcement yet.

If Then Else contained in Loop

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    Great!

    Thanks a bunch! :-)

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

    Comment

    Working...
    X