During my most recent project I've run into something that I don't know how to handle yet. I have a database which contains four categories: id, cd_artist, cd_title, and cd_tracks. Since I'm lazy and hate popping open a mysql session on the console I wanted to create a web interface for adding/editing/updating/deleting entries.
I've done this before with a script for a journal system, and it works great. However the cd database presents something of a problem. On the left I like to print out links so I can click them and have the info load into the forms on the right, but with ~200 cds currently in my database having it print out all 200 just to edit one is a waste. In my journal script I can just use the id field and print out the last 5 (or 10, or 15, etc..) and it's no big deal since the newest entry has the largest id and that's how they should be grouped. In the case of the cd database though, it messes things up.
The initial dump has everything in the correct alphabetical order, so the numbers increment along with that. But as you start adding new cd's to the database, the numbering/alpha order gets out of whack (duh). So what I wanted to do is have the script print out something like this:
a b c d e
f g h i j
(etc..)
..when the page is loaded with no cd id number on the url. That way you could click a letter, say C, and only the cds by bands whose name begins with the letter C would get displayed in that list. What's a good way of doing this?