anybody have an idea

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
grudz
Forum Commoner
Posts: 68
Joined: Thu Dec 04, 2003 12:52 pm

anybody have an idea

Post by grudz »

Hi,

I was wondering if anybody had any ideas how to structure this. I have a list of records that can be sorted by name, however, i want to put # - A -B - C - D - E.... etc... (all the letters of the alphabet) so that if the user clicks on "C" it shows everything the starts with "C", now my idea (but i dont think its the best way) was to have a $_GET for all the letters, like i said, does anybody have an easier way?

Thank you in advance
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

put A-Z on your page or use one of the scripts here, then use this:

Code: Select all

<?php
$letter = trim(addslashes($_GET['letter']));
$query = "select * from `tablename` where `fieldname` LIKE '$letter%'";
?>
grudz
Forum Commoner
Posts: 68
Joined: Thu Dec 04, 2003 12:52 pm

Post by grudz »

thanx, ill try that
Post Reply