Using the Sqlite3 database in CodeIgniter _php tutorial

Source: Internet
Author: User
Tags codeigniter
It is easy to use MySQL database in CodeIgniter, as long as the application/config/database.php Configure the database name, account password to use.





It's a little tricky to change to SQLite, CodeIgniter by default the PHP5 comes with a driver to support SQLite and the driver only supports the SQLite 2.x version. Fortunately, since CodeIgniter 2.1 has built-in SQLite's PDO driver, through the PDO driver can achieve the support of sqlite3.



application/config/database.phpoptions in the editor:


$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 gives you direct access to the SQLite database.



The source of this article: Mango station






http://www.bkjia.com/PHPjc/363808.html www.bkjia.com true http://www.bkjia.com/PHPjc/363808.html techarticle It is easy to use MySQL database in CodeIgniter, as long as the database name and account password can be configured in application/config/database.php. Change to SQLite ...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.