PHP 手冊
前一頁 |  | 下一頁

# sqlite_factory

(PHP 5)

sqlite_factory -- Opens a SQLite database and returns a SQLiteDatabase object

## Description

SQLiteDatabase sqlite_factory ( string filename [, int mode [, string &error_message]] )

Returns a SQLiteDatabase object on success, `NULL` on error.

sqlite_factory() behaves similarly to sqlite_open() in that it opens an SQLite database or attempts to create it if it does not exist. However, a SQLiteDatabase object is returned rather than a resource. Please see the sqlite_open() reference page for further usage and caveats.

範例 1. sqlite_factory() example
`<?php $dbhandle = sqlite_factory('sqlitedb'); $dbhandle->query('SELECT user_id, username FROM users'); /* functionally equivalent to: */ $dbhandle = new SQLiteDatabase('sqlitedb'); $dbhandle->query('SELECT user_id, username FROM users'); ?>`

See also sqlite_open() and sqlite_popen().

前一頁 | 內容 | 下一頁
sqlite_exec | 上一層 | sqlite_fetch_all