PDA

View Full Version : PHP - Rotating links per Alpha


ronnie
05-17-2005, 07:17 PM
I have a place I need to rotate links by alpha, different each day. Like some links list do, each day the list starts with a different letter of the alphabet.

Seems I've seen people talk of using the day of the month to pick the letter. Course there are only 26 letters and months differ. Sure it's right on front of me, but I am sure not getting it right now.

I will of course use this to pull from my MySQL db.

Any ideas? Thanks in advance.

ronnie

cd34
05-17-2005, 07:28 PM
if you know your starting letter and record it somewhere:

select if(sortletter<'$firstletter',ascii(sortletter)+100,ascii(sortletter)),title from links order by 1,title;

ronnie
05-18-2005, 04:54 PM
Letter will be different each day. And will use the code in a db select, so would do the same thing each day, unless I am missing something.

ronnie