getting the first alphabet of a field
Posted on 2000-03-07
I want to basically develop an alphabetical search engine so that if a user Clicks on 'A' all the titles whose name starts with A are displayed, and likewise for all the other alphabets. But the problem is that some titles begins with Numbers (for eg. 123ofcricket) and some even with special characters such as 'alpha', 'beta' and the list is very long. One more requirement is that suppose no title begins with 'X' than X should not be displayed in the search list.
I am thinking of runing a select statement with a distinct clause to retreive all the first letters of title from the table, but I could not create the SQL query.
I am using a MySql database with Php as the scripting language.
Can anybody please help or suggest any other suitable method.
Kindly help with example.