Skip to main content
Inspiring
April 24, 2007
Question

A-Z listing advice needed

  • April 24, 2007
  • 4 replies
  • 311 views
Hi, I need to create an A-Z listing of a members directory where I will have A, B, C and so on all the way to X, Y, Z. When a user clicks on B for example, I want it to take the user to a page where it filters out all surnames in the database other than those that begin with B.

I know I can build 26 pages, one for each letter in the alphabet, but that just seems uneconomical. I am certain it can be acheived with one page and I filter via a recordset, but I can't get my head around it!

I'm thinking I have to do a wild card selection along the lines of:

SELECT *
FROM members
WHERE surname is LIKE 'MM_Param'

and the parameter passed would be 'B%' when B is clicked.

But that means building 26 'Got to Detail Page' links doesn't it?

Is the answer as basic as having to build 26 different pages? That seems like a lot of effort for something that seems simple. Any advice would be great and if you know of any tutorials that would be even better.

Thanks

Mat
This topic is closed to new replies. Start a new post to keep the conversation going.

4 replies

Inspiring
April 24, 2007
http://www.tom-muck.com/extensions/help/RecordsetNavigationSuite/NavigationLettersHelp.cfm

the above might be of some use,

i have all of toms stuff and never had any problems


k





"matthew stuart" <webforumsuser@macromedia.com> wrote in message
news:f0lba3$mph$1@forums.macromedia.com...
> Hi, I need to create an A-Z listing of a members directory where I will
> have A,
> B, C and so on all the way to X, Y, Z. When a user clicks on B for
> example, I
> want it to take the user to a page where it filters out all surnames in
> the
> database other than those that begin with B.
>
> I know I can build 26 pages, one for each letter in the alphabet, but that
> just seems uneconomical. I am certain it can be acheived with one page and
> I
> filter via a recordset, but I can't get my head around it!
>
> I'm thinking I have to do a wild card selection along the lines of:
>
> SELECT *
> FROM members
> WHERE surname is LIKE 'MM_Param'
>
> and the parameter passed would be 'B%' when B is clicked.
>
> But that means building 26 'Got to Detail Page' links doesn't it?
>
> Is the answer as basic as having to build 26 different pages? That seems
> like
> a lot of effort for something that seems simple. Any advice would be great
> and
> if you know of any tutorials that would be even better.
>
> Thanks
>
> Mat
>


Inspiring
April 24, 2007
You are on the right track, but you don't have to use 26 "go to deatil page" SB's. Just use regular links. example:

<a href="details.asp?sortBy="A"">A</a>
<a href="details.asp?sortBy="B"">B</a>
and so on...
Inspiring
April 24, 2007
It'll be far easier to create 26 detail links than 26 detail pages.

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004




Inspiring
April 24, 2007
> I'm thinking I have to do a wild card selection along the lines of:
>
> SELECT *
> FROM members
> WHERE surname is LIKE 'MM_Param'

That'll work.

> But that means building 26 'Got to Detail Page' links doesn't it?

Just set up a script to generate the links:

Here's some VB.net code I use to create 26 'filter by letter' links:

Function makeAlphabetFilter()
Dim intCount As Integer = 97 '97 = ascii 'a'
Dim strAlphaLinks As String
Dim qryStr_alphaFilter As String = Request.QueryString("alphaFilter")
While intCount < 123 '123 = ascii 'z'
strAlphaLinks = strAlphaLinks & _
"<a href='" & makeAlphabetLink(intCount) & "'>" & _
Microsoft.VisualBasic.Chr(intCount) & "</a>"
If intCount < 122 Then
strAlphaLinks = strAlphaLinks & " | "
End If
intCount = intCount + 1
End While
Return strAlphaLinks
End Function

Function makeAlphabetLink(ByVal intCharacter As Integer)
Dim newURL As String
newURL = "thisPage.aspx?alphaFilter=" &
Microsoft.VisualBasic.Chr(intCharacter))
Return newURL
End Function

-Darrel