Home  >  Article  >  Backend Development  >  Can PHP be used with sqlite?

Can PHP be used with sqlite?

(*-*)浩
(*-*)浩Original
2019-09-21 14:03:432556browse

How to enable the use of SQLite in PHP

Can PHP be used with sqlite?

##php default settings do not support sqlite database, in PHP 5.1.x In the future, it will come with the SQLtie database function, which only needs to be turned on in the configuration

PHP.ini (recommended learning:

PHP programming from entry to proficiency)

;extension=php_sqlite.dll

After PHP 5.2.x, it comes with the SQLtie PDO database function. You only need to enable it in the configuration.

PHP.ini

;extension=php_pdo_sqlite.dll

Create a SQLite database Two methods

1. Use PHP function to directly open and create

sqlite_open ("php100.db"); If the database exists, open it directly, if not, create a new one

2. Through SQLiteManager To create and manage SQLite database files

Familiar with common SQLite functions


sqlite_open(数据库名,模式,错误信息);打开数据库
sqlite_query(数据库连接参数,SQL参数);数据库执行
sqlite_num_rows(SQL返回句柄); 统计条数
sqlite_last_insert_rowid(数据库连接参数); 最后一条ID
sqlite_fetch_array(SQL返回句柄,返回索引); 数据库指针

The above is the detailed content of Can PHP be used with sqlite?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn