Hi Guys,

Just a quick question.  I've been using an sql query like this (using
wildcards):

$sql = "SELECT * FROM table WHERE
        $search_criteria LIKE '%$search_input%' ORDER by $search_criteria
ASC";

At the moment, if the search criteria was "First_Name" and the text
($search_criteria) was "ch", the returned query contains any name containing
"ch".  The trouble is, if the name you are after is Chris ...., you might
get a result like:

id 1 CHris etc etc
id 2 RiCHard etc etc
id 3 CHris etc etc

In other words, it seems to be sorting where the instance of the CH comes in
id number rather than alphabetically.  Is there a way of making the query
(using wildcards or without) if someone types in "a", the list will return
alphabetically with, like:

a
aa
ab
abc
ac
ace
ade

I'd explain more, but I really have to go.  Sorry.  Hope you can help, as
most of you often do :)

James



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to