Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners
Testimonials
Olivier Auverlot: "At my work (a universitary computer research laboratory), I'm alone to create all applications and databases. I don't know how I could do all the work without it. It's really a very productive software. I can focus on the database schemas and create quickly the user applications with a minimal amount of code to maintain".
Roger Brown: "Great product. The more I work with it, the more I am amazed at what it can do".

More

Add your opinion

PostgreSQL PHP Generator online Help

Prev Return to chapter overview Next

Suggestions

Suggestions for the AutoComplete editor can be based either on a data source (in this case you need to specify the data source name, field name, and the sort order) or on a PHP function with the following signature:

 

function OnGetSuggestions($term, &$suggestions);

 

Parameters:

$term

Current input

$suggestions

Array of suggestions for the current input

 

Example

The following example from our Feature Demo demonstrates how it is possible to use the Google API to get the list of suggestions. Don't forget to replace XXX to your Google API Key.

 

$url = 'https://maps.googleapis.com/maps/api/place/queryautocomplete/json?key=%s&input=%s';

$key = 'XXX';

$sourceUrl = sprintf($url, $key, urlencode($term)); 

 

$contextOptions = array(

    "ssl" => array(

        "verify_peer" => false,

        "verify_peer_name" => false

    )

);

 

$json = file_get_contents($sourceUrl, false, stream_context_create($contextOptions));

$result = json_decode($json, true);

if ($result['status'] == 'OK') {

    foreach ($result['predictions'] as $prediction) {

        $suggestions[] = $prediction['description'];

    }

} elseif ($result['status'] == 'OVER_QUERY_LIMIT') {

    $suggestions[] = 'Query limit is exceeded';

}

 

Minimum input length

Use this option to specify minimal amount of symbols to start retrieving suggestions.

 

Number of values to display

Defines the maximum number of suggestions to be displayed in the drop-down list.

 



Prev Return to chapter overview Next