title: How can I create a CRUD with Codeigniter using SQLite?
body: <p>I'm starting a new project where I want to use Codeigniter with SQLite. I searched information about this and I managed to conect and get data from my SQLite database but I have no idea of how can I create a CRUD for a table with this, I'm trying to do it the same way I did in the past with MySQL buy it is not working.</p>
  
  <p>Here is what I did:</p>
  
  <p>config/database.php</p>
  
  <pre><code>$db['default'] = array(
      'dsn'   =&gt; '',
      'hostname' =&gt; '',
      'username' =&gt; '',
      'password' =&gt; '',
      'database' =&gt; APPPATH.'/database/Pasapalabra.sqlite',
      'dbdriver' =&gt; 'sqlite3',
      'dbprefix' =&gt; '',
      'pconnect' =&gt; FALSE,
      'db_debug' =&gt; (ENVIRONMENT !== 'production'),
      'cache_on' =&gt; FALSE,
      'cachedir' =&gt; '',
      'char_set' =&gt; 'utf8',
      'dbcollat' =&gt; 'utf8_general_ci',
      'swap_pre' =&gt; '',
      'encrypt' =&gt; FALSE,
      'compress' =&gt; FALSE,
      'stricton' =&gt; FALSE,
      'failover' =&gt; array(),
      'save_queries' =&gt; TRUE
  );
  </code></pre>
  
  <p>config/autoload.php</p>
  
  <pre><code>$autoload['libraries'] = array('database');
  </code></pre>
  
  <p>models/modelo_prueba.php</p>
  
  <pre><code>&lt;?php
  defined('BASEPATH') OR exit('No direct script access allowed');
  
  class modelo_prueba extends CI_Model  {
  
      public function getTestData() {
          return $this-&gt;db-&gt;get('preguntas')-&gt;result();
      }
  }
  
  ?&gt;
  </code></pre>
  
  <p>controllers/Welcome.php</p>
  
  <pre><code>public function __construct() {
      parent::__construct();
      $this-&gt;load-&gt;library("grocery_CRUD");
  }
  
  public function prueba() {
  
          $this-&gt;load-&gt;model('modelo_prueba');
          $dataSet = $this-&gt;modelo_prueba-&gt;getTestData();
          $this-&gt;load-&gt;view('data_view', [
              'dataSet' =&gt; $dataSet
          ]);
  
      }
  </code></pre>
  
  <p>views/data_view.php</p>
  
  <pre><code>&lt;h4&gt;Lets test the data&lt;/h4&gt;
  &lt;?php
      if($dataSet) {
          foreach($dataSet as $dataItem) {
              echo $dataItem-&gt;definicion . "&lt;hr&gt;";
          }
      }
  ?&gt;
  &lt;h5&gt;done!&lt;/h5&gt;
  </code></pre>
  
  <p>This worked for me, it shows correctly all data in 'preguntas' database, but now I'm trying to create a CRUD just like I usually do with MySQL and it's working, it shows a database error.</p>
  
  <p>The only thing that I have changed from the code of above is Welcome.php</p>
  
  <pre><code>public function prueba() {
  
      $crud = new Grocery_CRUD();
      $crud-&gt;set_table('preguntas');
  
      $output = $crud-&gt;render();
      $this-&gt;load-&gt;view("example.php", $output);
  
  }
  </code></pre>
  
  <p>The error that is shown in the screen is the following:</p>
  
  <pre><code>A PHP Error was encountered
  
  Severity: Warning
  
  Message: SQLite3::query(): Unable to prepare statement: 1, near "SHOW": syntax error
  
  Filename: sqlite3/sqlite3_driver.php
  
  Line Number: 129
  
  Backtrace:
  
  File: C:\xampp\htdocs\Pasapalabra_Isidro\application\models\Grocery_crud_model.php
  Line: 436
  Function: query
  
  File: C:\xampp\htdocs\Pasapalabra_Isidro\application\libraries\Grocery_CRUD.php
  Line: 48
  Function: get_field_types_basic_table
  
  File: C:\xampp\htdocs\Pasapalabra_Isidro\application\libraries\Grocery_CRUD.php
  Line: 1567
  Function: get_field_types
  
  File: C:\xampp\htdocs\Pasapalabra_Isidro\application\libraries\Grocery_CRUD.php
  Line: 4507
  Function: showList
  
  File: C:\xampp\htdocs\Pasapalabra_Isidro\application\controllers\Welcome.php
  Line: 38
  Function: render
  
  File: C:\xampp\htdocs\Pasapalabra_Isidro\index.php
  Line: 315
  Function: require_once
  
  
  A Database Error Occurred
  
  Error Number: 0
  
  not an error
  
  SHOW COLUMNS FROM `preguntas`
  
  Filename: C:/xampp/htdocs/Pasapalabra_Isidro/system/database/DB_driver.php
  
  Line Number: 691
  </code></pre>
  
  <p>Anyone knows what is happening? There isn't any error with the database connection because the previous code worked, but it's like Grocery CRUD can't create a CRUD of an SQLite.</p>
  
  <p>I'm working with Codeigniter 3.1.4 and I created the SQLite database with SQLite Manager (Firefox) 0.8.3.1</p>
  
  <p>Thank you for your answers.</p>