Table Sorting


I’m a slightly new PHP programmer.

System/Server Stats

  1. Windows XP Pro SP2
  2. Apache Server
  3. PHP 4.01+
  4. MySQL 4.01+
  5. PHPMyAdmin 2.5+

I use this pc for personel and business/self organized project use along with small gaming.

I’m currently working on a project for my school that involves a new Staff Directory for the District.

I’ve seen on some sites, they have a navigation bar and you can click on a letter and it sorts the Table on the page to show that Letter only by Column.

If no one knows what i’m talking about, the mysql_query is set to the column name and when a visitor clicks on the letter, it displays the info from the column that starts with that letter.

ex: a visitor clicks on ‘A’

the table will display all names that starts with ‘A’ and not show the rest.

I would like to know how i could do that for my site.

I dont have any coding to show, but you can goto and click on any system then cheats and you can see the navigation bar to select a Game title that starts with that letter

I have an image for what i want, i just need the PHP coding aspect of it

sorry for the image size, I couldnt make it small and clear, just small but also readable

I use Macromedia Dreamweaver 8 for all my coding, i’m not a designer in anyway so i make simple table layouts.


It’s all about the query…

(see example)
$link = mysql_connect(‘localhost’, ‘mysql_user’, ‘mysql_password’);
if (!$link) {
die('Could not connect: ’ . mysql_error());
$database = ‘DatabaseName’;

$query = “SELECT * FROM tables WHERE fieldname LIKE ‘a%’”;
$result = mysql_db_query($database, $query)

// Code here to echo out data appropriately



alright, Thank you