Product Documentation

FairCom SQL for PHP

Previous Topic

Next Topic

Using PHP 5 with the SQL PHP API

The SQL PHP 5 API supplied with FairCom DB is a native PHP API designed specifically for interfacing FairCom DB with PHP 5.x.x. It does not support later versions of PHP.

The SQL PHP API is provided for environments that cannot use the PDO extension/PHP 7. Note that the preferred method of interfacing FairCom DB with PHP is to use the PDO extension, which supports all recent versions of PHP. See Using PHP 7 with the PDO Extension.

If you want to interface PHP 5.x.x. with FairCom DB using the sql.php API, follow the procedures in the appropriate part of this chapter:

As with all other tutorials in the c-tree series, each of these database programming tutorials is implemented with four simple code procedures: Initialize(), Define(), Manage(), and Done().

No matter which FairCom interface language you use, FairCom follows this same high-level flow in all tutorials. This makes it easy for developers to "cross-over" from one language interface to another as these basic concepts apply to all.


Every language requires some form of initial "logon" or "connection" procedure to establish a session with the database. This is done in the Initialize() stage of the program.


Database definitions (DDL), Table/File schema definitions, Index definitions, Table/File creation, and Table/File open operations are all addressed in the Define() stage of the program.


This stage of the program is where the database is operated on, as in managing your data. Adding/Reading/Updating/Deleting records/rows are handled in this stage of the program.


When the program ends, the database session should be closed. This stage handles the necessities to "de-init", by closing Tables/Files and issuing any required "logoff" or "disconnect" type procedures.

Presented here are tutorials that follow the "Initialize(), Define(), Manage(), and Done()" approach.

You can also view similar tutorials for all supported languages online.

In This Chapter

Using the SQL PHP 5 API and Microsoft IIS on Windows

Using the SQL PHP 5 API on Linux and Unix