Working with SQLite in codeigniter Working with SQLite in codeigniter codeigniter codeigniter

Working with SQLite in codeigniter


I've had the same issue when using CI 2.1.0 and found the following fix for the fatal error:

In system/database/DB_driver.php change:

Line 1165

$message = $error;

to

$message[] = $error;

Line 1169

$message = ( ! is_array($error)) ? array(str_replace('%s', $swap, $LANG->line($error))) : $error;

to

$message[] = ( ! is_array($error)) ? array(str_replace('%s', $swap, $LANG->line($error))) : $error;

Source


Never tried to use SQLite with CI, but I found a possible answer to your problem. Try adding 'sqlite:' in front of your database name, like:

$db ['default'] ['database'] = 'sqlite:'.APPPATH.'db / producers.sqlite';

Source.


To solve the error "Fatal error: [] operator not supported for strings"

I modify file in *DB_driver.php:1171*

adding this line:

$message = (array)$message;