Connect to sqlite database
Connect to sqlite database using connect function. You need to set file path for sqlite in database name and set dbType = "sqlite"
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. "" |
| $password - password | string | e.g. "" |
| $databaseName - database name | string | e.g. "" |
| $dbType - type of db | string | e.g. "sqlite"(default), pgsql, mysql |
| $charset - character set | string | e.g. "utf8" |
Examples
$pdomodel = new PDOModel(); //create object of the PDOModel class
$pdomodel->connect("", "", "", "path-of-sqlite-file","sqlite");//connect to database
More Examples
// another way
$pdomodel->dbSQLitePath = "path-of-sqlite-file";
$pdomodel->connect("", "", "", "" ,"sqlite","");//connect to database
Result/Output
SQLite Database will be connected
Debug
| Option | Details | Example |
|---|---|---|
| print_r($pdomodel->error) | Print errors (if any) |