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"

Examples

  
                                $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                                
                            

Result/Output

PGSql Database will be connected

Debug

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