Welcome Guest, Not a member yet? Register   Sign In
CI4 and sqlite
#1

Hello I would like to create a simple application using sqlite. I am starting from scratch and I hope that it is stable enough for soon production.

I am in my first day and I used to code with CI3 but I wanted to learn CI4.

I install CI4 and see the defaut welcome page

Then I create a Test.php controler to test the database. My goal is to read, update and delete row of a table.

First test with mysql is ok I can read my data

I add this

       $db = db_connect();
       $strsql = "select * from aaa";
       $query = $db->query($strsql);

       $results = $query->getResult();

        foreach ($results as $row)
        {
               echo '<br/>'.$row->uscode;
        }
       


Now with sqlite I have this
1. Database.php
    public $default = [
        'DSN'      => '',
        'hostname' => '',
        'username' => '',
        'password' => '',
        'database' => APPPATH . 'Database/db1.db',
//      'DBDriver' => 'MySQLi',
        'DBDriver' => 'sqlite3',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug'  => (ENVIRONMENT !== 'production'),
        'cacheOn'  => false,
        'cacheDir' => '',
        'charset'  => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre'  => '',
        'encrypt'  => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port'     => 3306,
    ];


I have db1.db that I put in  app/Database directory
 I have an error.  I notice that the linethat gave me the error is

       $db = db_connect();

What is wrong what did I miss?
In the documentation I didn't see anything with sqlite configuration.
Reply


Messages In This Thread
CI4 and sqlite - by kris2 - 10-05-2019, 07:27 AM
RE: CI4 and sqlite - by kris2 - 10-07-2019, 08:10 AM
RE: CI4 and sqlite - by kilishan - 10-07-2019, 10:50 AM
RE: CI4 and sqlite - by kris2 - 10-07-2019, 02:02 PM
RE: CI4 and sqlite - by kris2 - 10-09-2019, 04:18 AM
RE: CI4 and sqlite - by ciadmin - 10-09-2019, 04:32 AM
RE: CI4 and sqlite - by captain-sensible - 04-25-2020, 12:04 PM
RE: CI4 and sqlite - by AndreiCurelaru - 10-12-2019, 05:55 PM
RE: CI4 and sqlite - by chaker7 - 12-12-2022, 04:11 AM
RE: CI4 and sqlite - by InsiteFX - 12-13-2022, 12:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB