Hi all,
I am a php rookie. I like to get a PHP function returning an array which gets a string(search query) and db results(an array) as arguments. This array should be sorted in ascending (alphabetical) order with search query positions.
I tried of querying the results but i struck up with sorting with search query positioning.
My db Array()
{
Hussain,Dalton,Zaheerus,beltwood,usher,johnny,walker,
}
My snippet

function getSearchRecords  ($string){
         $listRecords=array();

        $query="select name,member_id from member_details where name like '%$string%' order by name";
        $queryResult =  self::DbExecuteQuery($query);
        while($getRecords = self::DbFetchAssoc($queryResult)){
			array_push($listRecords,$getRecords);
			}
	return $listRecords;

$string="us";
will return hussain,usher,zaheerus (in this order).
but i need this function to return
usher [position of search query is at first]
Hussain
zaheerus[position of search query is at last]