开发者

Accessing SQLite database with PHP

开发者 https://www.devze.com 2023-01-12 14:49 出处:网络
I am interested in using a SQLite database in my next project because it needs to be ultra-portable and a simple file that a class can connect to and use as a database seems perfect.

I am interested in using a SQLite database in my next project because it needs to be ultra-portable and a simple file that a class can connect to and use as a database seems perfect.

After Google'ing a bit I found开发者_高级运维 this: http://php.net/manual/en/book.sqlite.php

But that seems to work with an older version of SQLite and doesn't seem to be reccomended. Does anyone know what class or functions etc I should be using to use an SQLite database? I plan to write my own class for interfacing with the database, so preferably just some functions like in the link I posted but with the up-to-date version of SQLite.

Any help is appreciated, thanks.


PDO seems your best bet.

From here:

If you intend to use SQLite 3.x releases of SQLite with your development please refer to the section on PHP Data Objects, and specifically the PDO-SQLite implementation available at(references: http://us.php.net/manual/en/book.pdo.php , http://au2.php.net/manual/en/ref.pdo-sqlite.php).

PDO SQLite functions manual

Update: As @Joe mentions, there is also a standalone SQLite 3 class.


theres nothing wrong with those sqlite function, you can use them. however there is sqlite3 http://www.php.net/manual/en/book.sqlite3.php which is object orientated. what i personally would suggest is the adodb wrapper which can easily port to any database and is very reliable at http://de.wikipedia.org/wiki/ADOdb

0

精彩评论

暂无评论...
验证码 换一张
取 消