Before you begin coding using phpGrid, you must specify database information in conf.php. conf.php is our phpGrid configuration file in which we specify database connection parameters and path to the phpGrid.
Please note that in PHP, the method name and parameters are case sensitive.
1 2 3 4 5 6 7 8 | define('DB_HOSTNAME','hostname'); // database host name or TNS name (Oracle only) define('DB_USERNAME', 'username'); // database user name define('DB_PASSWORD', 'password'); // database password define('DB_NAME', 'sampledb'); // database name define('DB_TYPE', 'mysql'); // database type define('DB_CHARSET','utf8'); // OPTIONAL. Leave blank to use the default charset define('SERVER_ROOT', '/phpGrid_folder'); // URL to phpGrid folder. |
SERVER_ROOT, formerly known as ABS_PATH, represents the absolute URL to the phpGrid library folder on the web server. This value tells your script where to find phpGrid library on the web server.
For instance, if the URL to get to the phpGrid is http://www.yoursite.com/phpGrid, or http://localhost/phpGrid, the SERVER_ROOT should be “/phpGrid“.
if the URL to phpGrid is http://www.yoursite.com/admin/phpGrid, or http://localhost/admin/phpGrid, the SERVER_ROOT should be “/admin/phpGrid“,
and so forth.
Once values in conf.php are set, simply reference phpGrid by adding the following at on top of your PHP code:
1 | require_once("phpGrid/conf.php"); |
Database Type
phpGrid supports wide range of database types. Simply define DB_TYPE parameter value to your own database type. It can be one of the following strings. The default database type for phpGrid is “mysql”. DB_TYPE string is case sensitive.
| DB_TYPE | Description |
|---|---|
| mysql | MySQL (default) |
| odbc_mssql | SQL Server |
| oci805 | Oracle |
| postgres | PostGreSql |
| access | Microsoft Access |
| db2 | DB2 |
| informix | Informix |
| informix72 | Alternative Informix Driver |
| odbc | Generic ODBC |
A full list of supported databases and naming convention are available in ADOdb website. Not required but we encourage users to visit ADOdb website. It helps you understand how phpGrid utilizes it under the hood.
phpGrid now supports local array data source without using a database.
Oracle only
When using Oracle database with TNS(Transparent Network Substrate), replace the database host name with the TNS Name in conf.php e.g. define(‘DB_HOSTNAME’,<YOUR ORACLE TNS NAME>);


