Informix

From RadPHP XE2 Documentation
Jump to: navigation, search

Contents

Initial Setup

To get PHP and Informix working together when you run the code from RadPHP, uncomment (remove the ; at the beginning) the following line on RadPHP php.ini.template file:

;extension=php_ifx.dll

Usage

Database Setup

To use a Database component with Informix, set it up so it uses Informix driver:

  • DriverName: informix.

Do not forget to fill also the rest of the basic information. You can leave the Host property empty, though.

Work From PHP

// Set Connection Data
$database = 'database';			// Database address in the form: databasename@server.
$user = 'user';				// Username to access the database.
$password = 'password';			// Password for the user.
 
// Establish Connection
$connection = ifx_connect($database, $user, $password);
 
// Connection Test
if (!$connection)
    echo 'Informix Database could not be reached';
else
    echo 'Succesfully connected to Informix database';
 
// Perform a Query
$result = ifx_query("SELECT * FROM orders", $connection);
if (! $result) {
    printf("Can’t get orcers: %s<br />%s<br />", ifx_error(), ifx_errormsg());
    die;
}
ifx_free_result($result);

See Also

Personal tools