Google Answers Logo
View Question
 
Q: How to jump to a certain page in an array ( No Answer,   0 Comments )
Question  
Subject: How to jump to a certain page in an array
Category: Computers > Algorithms
Asked by: inkeye777-ga
List Price: $12.00
Posted: 18 Sep 2006 21:48 PDT
Expires: 19 Sep 2006 06:47 PDT
Question ID: 766475
I have a web site using PHP and a database that stores a list of
several hundred song titles alphabetically.  The same song may be
listed in the array 10 times (for different versions), and some letters of
the alphabet (or numerals even) may have no songs that start with that
letter (like Q or X or Z).

Currently, I have in memory the array of all songs in my list, split
into multiple pages of 25 records each.  I know how many pages there
are, which page number I'm currently on, and also the
first/last/next/previous page numbers.

What I WANT to do is have a row of letters at the top that the user
will click on, and that will take him/her to the page that has the
titles starting with that letter:

1 7 A B C G H J L M N V Y

The row might have letters missing (because if you don't have any
songs that start with 'X' I don't want to take you to a wrong/dead
page.

Also, clicking on the letter will not simply do a new query for all
the songs with that letter (that's the easy way and not what I want). 
Instead, it should only take you to the page that contains songs
starting with that letter.  So, clicking on the letter "Y" might
actually have songs that also start with the letter "V".

Simple enough?  How do you do this?  Do I just have to run through the
array 26 times?  I just need the concept and maybe some pseudo-code if
necessary.
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy