removing same listings if multiple

Results 1 to 2 of 2

Thread: removing same listings if multiple

  1. #1
    Join Date
    Dec 1969

    Default removing same listings if multiple

    I&#039;ve got a table that&#039;s display the name of page, it&#039;s URL, and a corresponding keyword for that page. But b/c I&#039;m listing all the pages/urls/keywords from the database in a Do While Loop. It works, but I have multiple same page names with different keywords and I want to get rid of it. Basically, it looks like this right now:<BR><BR>Contact Us /contact.htm contact<BR>Contact Us /contact.htm help<BR>Contact Us /contact.htm phone<BR><BR>But I want it to read:<BR><BR>Contact Us /contact.htm contact, help, phone<BR><BR>So there&#039;s only one instance of the name and URL, but all the keywords are listed. <BR><BR>Does that make any sense?

  2. #2
    Join Date
    Dec 1969

    Default Try this..

    Very crude, but it will work. Use a variable to grab the name of the previous page and if it matches the current page use an if/else statement to write a comma and the next keyword. It sounds confusing but it will make sense if you read it a couple of times.<BR><BR>Dim varNameGrabber<BR>varNameGrabber = ""<BR>&#039;Set and open connection<BR>While NOT connection.EOF<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If varNameGrabber = connection("Page Name") Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Response.Write ", " & connection("keyword")<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp; &#039;Write a new table row<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<BR>varNameGrabber = connection("Page Name")<BR>Wend<BR><BR>&#039;close connection etc

Posting Permissions

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