Need help creating a PHP 'A to Z'
Posted: Tue Jan 31, 2006 1:10 am
Hi
I'm new to using PHP and MySQL and I'm trying to create a web-based database of my music collection.
I have all of the artists in a DB table, and from this am trying to produce an unordered list A to Z, and where the letter exists as the initial letter of an artist, to make this a link to refine the view - the letters that don't exist in the DB must still be shown - just not be links.
To select the letters of the artists I'm using:
I have also put each letter of the alphabet as individual rows in another table called alphabet.
I'm not quite sure what I need to be doing. I've been using a mixture of while and for loops, but to no real avail. At my worst I have got 26 of each letter echoed with one a link, and at my best, 1 of A, 2 of B.... 26 of Z (they both sound bad really
) .
Thanks in advance if anyone can tell me how to solve this.
:: demonseed101 ::
I'm new to using PHP and MySQL and I'm trying to create a web-based database of my music collection.
I have all of the artists in a DB table, and from this am trying to produce an unordered list A to Z, and where the letter exists as the initial letter of an artist, to make this a link to refine the view - the letters that don't exist in the DB must still be shown - just not be links.
To select the letters of the artists I'm using:
Code: Select all
SELECT distinct left(artist,1) FROM bb_artistsI'm not quite sure what I need to be doing. I've been using a mixture of while and for loops, but to no real avail. At my worst I have got 26 of each letter echoed with one a link, and at my best, 1 of A, 2 of B.... 26 of Z (they both sound bad really
Thanks in advance if anyone can tell me how to solve this.
:: demonseed101 ::