0

I'm using Autocomplete UI. I have some ploblems with results of a database source, what i need its simple:

In the example from doc's, they have a array like this:

$items = array(
 "Great Bittern"=>"Botaurus stellaris",
 "Little Grebe"=>"Tachybaptus ruficollis",
 "Black-necked Grebe"=>"Podiceps nigricollis"
)

and what I have its a database result working with a while().

I try something like this:

while(!$resrank->EOF){
    $array = array($resrank->fields["FIELD1"] => $resrank->fields["FIELD2"]);
    $resrank->MoveNext();
}

but obviously he creates alot of array's.

instead of that, i need array's like the example using while() or foreach(), dont know, any better way. How can i do this?

I'm not quite familiar with php.

1 Answer 1

2

Instead of creating individual arrays you need to populate the same one:

$items = array();
while(!$resrank->EOF){
    $items[$resrank->fields["FIELD1"]]  = $resrank->fields["FIELD2"];
    $resrank->MoveNext();
}

Good luck!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.