LJG wrote:
> Hi I am looking to have a grid A - Z so slecting a
letter filters the records
> for just the names of that letter, does anyone know the
best way to do this?
> has anyone done it?
When asking this sort of question, it's important to say
which server
model and database you're using, because the code for each
one is
different. However, the principle is the same for all.
1. To create the A-Z list, create a recordset that selects
the first
letter of the column on which you want to base the index. Say
it's a
list of people, you want the first letter of everyone's
family name. In
MySQL, you would use the following as the SQL query:
SELECT DISTINCT LEFT(family_name, 1) AS letter
FROM my_table
Using the LEFT() function with 1 as the second argument gives
you the
first letter only of each family name. DISTINCT eliminates
duplicate
entries. This produces a recordset of initial letters to
build your index.
2. Build the index using the recordset, and create a link to
your
display page. Select the Parameters button in the Select File
dialog
box, and set the name to "letter", and bind the value to
"letter" from
the recordset. This adds a query string to the end of the
link in the
form ?letter=m.
3. In your master page, create a recordset using the URL
parameter
"letter" as the filter.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/