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

Subscribe to our news:
Partners
Testimonials
Kirby Foster: "Nice software. Small, lightweight, works well. I evaluated lots of software before deciding that your software worked the best for what I do. Both Maestro for MySQL and PHP Generator have saved me lots of time".
Craig Cordell: "The simplicity of your code generator is fantastic. We've evaluated dozens of others over the past few years but have yet to find one that is as easy to use as yours".

More

Add your opinion

PHP Generator for MySQL 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