Re: [PHP] reading records alphebetically

2001-06-30 Thread Jack Sasportas
Since you only have a few records, creating a second index with the first letter doesn't apply to you, but is a good idea in a huge db scheme. The simplest & fastest way is to take the suggestions a few people made which is SELECT * FROM table WHERE name LIKE '$letter%' I would not suggest this

Re: [PHP] reading records alphebetically

2001-06-30 Thread Julia A. Case
Try using a query like select * from table_name where name like '$letter%'; Julia Quoting Jamie Saunders ([EMAIL PROTECTED]): > Hi, > > I have a MySQL database set-up containing a few hundred records. I'm trying > to make a script that reads the 'name' field of the records and displays > only

RE: [PHP] reading records alphebetically

2001-06-30 Thread Warren Vail
If you are planning to have a lot of records, you may want to create a column with just that letter and index it, followed by the full name. SELECT name from Table WHERE first_letter = "$letter" ORDER by name should produce pretty fast results if "first_letter, name" is indexed. Warren Vail --

Re: [PHP] reading records alphebetically

2001-06-30 Thread Ethan Schroeder
You can either select the letter you want through mysql with "SELECT * FROM table WHERE name LIKE '$letter%' Or you can select everything: $result = mysql_query("SELECT * FROM table order by name"); while ($row = mysql_fetch_array($result)) { extract($row); $first_letter = strtolower($name[