It is easy to use mysql database in Codeigniter. Just configure the database name, account and password in <font face="NSimsun">application/config/database.php</font>
and you can use it.
It is a little more troublesome to switch to sqlite. Codeigniter uses PHP5's own driver to support sqlite by default, and this driver only supports sqlite 2.x version. Fortunately, starting from Codeigniter 2.1, the pdo driver of sqlite has been built-in. Support for sqlite3 can be achieved through the pdo driver.
Edit options in <font face="NSimsun">application/config/database.php</font>
:
$db['default']['hostname'] = 'sqlite:' . FCPATH . '../db/tms.db'; $db['default']['username'] = ''; $db['default']['password'] = ''; $db['default']['database'] = ''; $db['default']['dbdriver'] = 'pdo'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE;
This way you can directly access the sqlite database.
Source of this article: Mango Station