Use sqlite3 database in Codeigniter _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Use the sqlite3 database in Codeigniter. It is easy to use the mysql database in Codeigniter. you only need to configure the database name and account password in applicationconfigdatabase. php. Changing to sqlite makes it easy to use mysql databases in Codeigniter. application/config/database.phpYou can use it after configuring the database name and account password.

It is a little troublesome to change to sqlite. Codeigniter uses the PHP5 built-in driver by default to support sqlite and this driver only supports sqlite 2.x. Fortunately, the pdo driver of sqlite has been built into Codeigniter 2.1, and sqlite3 can be supported through the pdo driver.

Editapplication/config/database.phpOptions in:

$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;

In this way, you can directly access the sqlite database.

Source: Mango Xiaozhan

Codeigniter is easy to use mysql databases. you only need to configure the database name and account password in application/config/database. php. Change to sqlite...

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.