GOModel pgsql database connection

Connect to pgsql database

Connect to pgsql database using connect function. You need to pass host/servername, username, password, database-name. Optionally, you can pass charset.

Function Defination

                                void function connect($hostName, $userName, $password, $databaseName, $dbType = "mysql", $charset = "utf8");

Parameters Details

Details Type Example
$userName - username of database to connect with string e.g. "root"
$password - password string e.g. ""
$databaseName - database name string e.g. "empDB"
$dbType - type of db string e.g. "pgsql"(default), sqlite, mysql
$charset - character set string e.g. "utf8"


                                $GOModel = new GOModel(); //create object of the GOModel class
                                $GOModel->connect("localhost", "root", "", "database","pgsql");//connect to database

More Examples

                                $GOModel->connect("localhost", "root", "", "database" ,"pgsql","utf8");//connect to database                                


PGSql Database will be connected


Option Details Example
print_r($GOModel->error) Print errors (if any)