I have a database moja.db created with DB Browser for SQLite.
I created gridtest.php with code:
I get message Please check your database connection configuration. Connection attempt failed: SQLSTATE[HY000] [14] unable to open database file
What do I have to do to make it work?
Sorry, code didnt displayed in previouse message.
<?php
$db_conf = array();
$db_conf[“type”] = “pdo”; // mysql,oci8(for oracle),mssql,postgres,sybase
$db_conf[“server”] = “sqlite:moja.db”;
$db_conf[“user”] = “”;
$db_conf[“password”] = “”;
$db_conf[“database”] = “moja”;
?>
If your database and grid code file reside in same folder, try
$db_conf[“server”] = “sqlite:./moja.db”;
Added ./ before moja.db.
You can also refer working demo:
Code:
https://www.gridphp.com/demo/demos/loading/db-layer-sqlite.phps
Demo: https://www.gridphp.com/demo/demos/loading/db-layer-sqlite.php
You don’t need to set db. Make it blank.
$db_conf[“database”] = “”;