I have a page that is a directory of names ordered by lastname, firstname (e.g. SELECT fn, ln FROM directory ORDER BY ln, fn LIMIT 0,10).

I have it paginated so that there are 10 results per page. What I'd like to do instead of having page numbers (which can be unhelpful when trying to page through people's names) is be more like a phone book and let people click on links that are the first letters of their last names

For example, let's say my result set for

SELECT fn, ln FROM directory ORDER BY ln, fn LIMIT 30, 10

is

Jackson
Johnson
Knutson
Kraig
Liver
Lombard
Marx
Maxx
Milton
Nixon

The page link would be

J-N

I know how to get the letters for one page (well I think I do at least), but I want to get them for all pages

So basically I'd have something like this for my page list:

A B-C D E-G F-H I J-N O-Z

and clicking on each page would result in entries only from that letter. The trick is I don't want more than 10 entries a page. Is there an easy way to do this? Possibly in a single query?

Thanks

-dd


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to