Page 1 of 1

Order MySQL results by first letter

Posted: Mon Apr 16, 2007 7:08 pm
by thunderbox
hey im writing a user system, and in the admin panel i need the option to ONLY show usernames selected by the Admin (from a dropdown box)
i have the Letter being submitted by a $_POST command, but I'm not sure how to order the results based on that $_POST submission

thanx for your help

Posted: Mon Apr 16, 2007 7:20 pm
by John Cartwright

Posted: Mon Apr 16, 2007 7:26 pm
by aaronhall
To only return results starting with a specified letter:

Code: Select all

SELECT * FROM `table` WHERE `column` LIKE 'a%' ORDER BY `column`;

Posted: Mon Apr 16, 2007 8:30 pm
by John Cartwright
Yea go with aaron, I missed the mysql part.

Posted: Mon Apr 16, 2007 11:27 pm
by thunderbox
thanx guys.... i was completely stumped on the sort() command.. i didn't know what to do with it