Join 149,504 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,370 people online right now. Registration is fast and FREE... Join Now!
I'm building a web page that has a list of different realestate locations and pulls this info from a database. The user can filter and view the properties by location. My problem is, is that I would like to display a header above the first location, but not have it repeat.
For example, say I have 5 listings in the Northern Heights area. I'd like to display "Nothern Heights" as the first line and the following lines are the listings. When the loop finds the next area, say in the Harbor View location, have it display "Harbor View" and then show the listings for that location and so on for all the locations in my db.
Anyone have any idea how to do this? Any help would be appreciated. This is an ASP page using VBScript.
I'm building a web page that has a list of different realestate locations and pulls this info from a database. The user can filter and view the properties by location. My problem is, is that I would like to display a header above the first location, but not have it repeat.
For example, say I have 5 listings in the Northern Heights area. I'd like to display "Nothern Heights" as the first line and the following lines are the listings. When the loop finds the next area, say in the Harbor View location, have it display "Harbor View" and then show the listings for that location and so on for all the locations in my db.
Anyone have any idea how to do this? Any help would be appreciated. This is an ASP page using VBScript.
Is the location being returned with the query? I assume you are showing miltiple areas in a single page and that's whats causing the problem?
I'm assuming rs("Name") is what you're trying to display as a header. Try something like this (it may not work exactly at first but you can tweak it as needed, if you cant let me know and Ill help as much as I can). What you need to do is actually loop within a loop. The first loop is, of course, to display all the properties, the 2nd loop loops through all the properties for the ones for that specific location (rs("Name")), then at the end of that loop it resets the variable for rs("Name") and starts the loop all over again. This should give you a header, all the properties for that header, the next header, and so on.
Good job, Psycho! And I thought I was the only one left here who worked with classic vbscript!
I work with it if I have to, otherwise I stick with ASP.Net. Also, I've used classic ASP for so long it's like riding a bicycle, once you learn you never forget. I bet I have every ASP website I've ever created on one of my hard drives (thats 10+ years of coding by the way)