Creating an Array for website navigation.

Results 1 to 3 of 3

Thread: Creating an Array for website navigation.

  1. #1
    Join Date
    Dec 1969

    Default Creating an Array for website navigation.

    I have a table in my DB that contains the following Column names:<BR><BR>Name, PNAVID, ContentID, url<BR><BR>This table is for creating dynamic site navigation where by a sql statement like: <BR>SELECT Name, PNAVID, ContentID, url FROM dbo.WEB_PRIMARY_NAV ORDER BY Name"<BR><BR>Should create html to display somthing like this:<BR>&#060;a href="Content.asp?ContentID=&#060;%=rs("ContentID" )%&#062;&URL=&#060;%=rs("url")%&#062;&PNavID=&#060 ;%=rs("PNAVID")%&#062;"&#062;=&#060;%=rs("Name")%& #062;&#060;/a&#062;<BR><BR><BR>Results to the user<BR>Page 1<BR>Page 2<BR>Page 3<BR><BR>The results are all hyperlinked to my Content.asp page that also passes 3 different variable in the url string (ContentID,PNavID, url)<BR><BR><BR>How can I set this up so that I can use an array rather than a loop?<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default If you are talking about displaying the

    results to the user, you still are going to have to "loop" thru an array too. ; )<BR><BR>Anyways if you are asking how to get your results in an array, look up the getrows method for a recordset object. There are examples of using this in the faqs.<BR><BR>Pete

  3. #3
    Join Date
    Dec 1969

    Default RE: Creating an Array for website navigation.

    immediately after you populate your recordset, do this: <BR><BR>arrMyArray = MyRs.GetRows()<BR><BR>Then destroy your recordset and close your DB connection. <BR><BR>Then you would loop through your array, much in the same way you do a recordset. <BR><BR>For i = 0 to ubound(arrMyArray,2) <BR> Response.Write arrMyArray(0,i)<BR> Response.Write arrMyArray(1,i)<BR> Response.Write arrMyArray(2,i)<BR>Next<BR><BR>What we&#039;re saying is i = 0 (zero is the first element in the array) and loop until i equals the last element (upper bound, ubound) of the array. <BR><BR>Then we&#039;re writing out the array, specifying the column with a number (again, starting at zero) and using the variable i to specify which row. <BR><BR><BR>

Posting Permissions

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